Live preview of docs in VSCode #2093
samsrabin
started this conversation in
Show and tell
Replies: 2 comments 5 replies
-
|
@olyson do you know the answer to @samsrabin questions above? |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Cool, @samsrabin - thanks for writing this up! I'm not sure about this:
But I do know that this line:
was important to get better-looking equations in the rendered documentation. I'm not sure whether that relies on the sphinx.ext.imgmath package. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've been doing a bit of work on the docs and finally worked out a good way to preview them from within VSCode. It takes a bit of effort, but once it's working it's pretty nice.
Instructions
The first step is to install the reStructuredText extension for VSCode. Their website has some documentation that's helpful for understanding what it's useful for and how to set it up (note especially Prerequisites and Configuration). I'll describe my process here.
mambabut it should work equally well withconda. Instructions updated 2024-11-01.Python: Select Interpreter.Esbonio › Server: Python Pathto the path you get when you dowhich pythonin yourvscode-restructuredtextenvironment.Esbonio › Sphinx: Conf Dirto${workspaceFolder}/doc/source.Esbonio › Sphinx: Build Dirto${workspaceFolder}/.vscode/_build_esbonio_sphinx/. This will make it so that the generated HTML files etc. are ignored by Git.Esbonio › Sphinx: Force Full Build.Esbonio › Sphinx: Num Jobsto 0. This will allowsphinx-buildto automatically determine how many processes to use when generating the HTML..rstfile from the docs (e.g.,doc/source/tech_note/Methane/CLM50_Tech_Note_Methane.rst). Open the Command Palette and doreStructured Text: Open Preview to the Side. This should show the Tech Note we all know and love!Tweaking the .rst files
There are some things that didn't work right until I actually edited the docs themselves.
Mathematical symbols and equations were mostly or all broken:

I solved this by deleting the

'sphinx.ext.imgmath',line fromdoc/source/conf.py:Some equations still didn't render:

I solved this by deleting all instances of

\kern-\nulldelimiterspacein all.rstfiles:Caveats
Clicking links in the Live Preview opens my web browser to some unfindable page.
There are some warnings about failed references that I want to track down:
Questions
sphinx.ext.imgmath? The basesphinxseems to include math rendering capabilities now.\kern-\nulldelimiterspacedoing something important?Beta Was this translation helpful? Give feedback.
All reactions