-
Notifications
You must be signed in to change notification settings - Fork 415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Tutorials] Consistently use LaTeX delimiter for Docusaurus #2752
Conversation
@CristianLara has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2752 +/- ##
=======================================
Coverage 99.99% 99.99%
=======================================
Files 203 203
Lines 18705 18705
=======================================
Hits 18704 18704
Misses 1 1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Enforcing correct formatting from start makes sense
@CristianLara has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
This is a duplicate of the same code change in botorch: pytorch/botorch#2752 Docusaurus 3 requires math to be wrapped in $ delimiters. We were trying to be backwards compatible with our existing tutorials by wrapping math blocks in $ delimiters while converting to MDX but properly handling every type of math block (which this was failing to do) is beyond the scope of this script. Since these tutorials are intended to be consumed by Docusaurus lets just enforce the $ delimiters when writing tutorials.
This is a duplicate of the same code change in botorch: pytorch/botorch#2752 I was noticing that sometimes (depending on a variety of factors like the editor used to modify the tutorial, whether they had been executed) the conversion script would fail because the cell source would be stored as a list of strings instead of a multi-line string. From the official nbformat documentation: > Some fields, such as code input and text output, are characteristically multi-line strings. When these fields are written to disk, they may be written as a list of strings, which should be joined with '' when reading back into memory. In programmatic APIs for working with notebooks (Python, Javascript), these are always re-joined into the original multi-line string. If you intend to work with notebook files directly, you must allow multi-line string fields to be either a string or list of strings. https://ipython.readthedocs.io/en/3.x/notebook/nbformat.html
Summary: This is a duplicate of the same code change in botorch: pytorch/botorch#2752 # LaTeX in Tutorials Docusaurus 3 requires math to be wrapped in $ delimiters. We were trying to be backwards compatible with our existing tutorials by wrapping math blocks in $ delimiters while converting to MDX but properly handling every type of math block (which this was failing to do) is beyond the scope of this script. Since these tutorials are intended to be consumed by Docusaurus lets just enforce the $ delimiters when writing tutorials. Before: <img width="1711" alt="image" src="https://github.com/user-attachments/assets/1d710d83-038b-4f81-907d-d2a93d1eba37" /> After: <img width="1711" alt="image" src="https://github.com/user-attachments/assets/21f4bc0a-9c52-49b7-88dd-5eef98606050" /> # Tutorial cell source I was noticing that sometimes (depending on a variety of factors like the editor used to modify the tutorial, whether they had been executed) the conversion script would fail because the cell source would be stored as a list of strings instead of a multi-line string. From the official nbformat documentation: > Some fields, such as code input and text output, are characteristically multi-line strings. When these fields are written to disk, they may be written as a list of strings, which should be joined with '' when reading back into memory. In programmatic APIs for working with notebooks (Python, Javascript), these are always re-joined into the original multi-line string. If you intend to work with notebook files directly, you must allow multi-line string fields to be either a string or list of strings. https://ipython.readthedocs.io/en/3.x/notebook/nbformat.html Pull Request resolved: #3401 Reviewed By: mpolson64 Differential Revision: D70990589 Pulled By: CristianLara fbshipit-source-id: ac189c938bfc24e39dc88a4f5861945b8ddcd6fb
Summary: Docusaurus 3 requires math to be wrapped in $ delimiters. We were trying to be backwards compatible with our existing tutorials by wrapping math blocks in $ delimiters while converting to MDX but properly handling every type of math block (which this was failing to do) is beyond the scope of this script. Since these tutorials are intended to be consumed by Docusaurus lets just enforce the $ delimiters when writing tutorials. Reviewed By: saitcakmak Differential Revision: D69947509 Pulled By: CristianLara
d984183
to
606487f
Compare
This pull request was exported from Phabricator. Differential Revision: D69947509 |
@CristianLara merged this pull request in 307cf04. |
Docusaurus 3 requires math to be wrapped in $ delimiters. We were trying to be backwards compatible with our existing tutorials by wrapping math blocks in $ delimiters while converting to MDX but properly handling every type of math block (which this was failing to do) is beyond the scope of this script.
Since these tutorials are intended to be consumed by Docusaurus lets just enforce the $ delimiters when writing tutorials.