2

I have a project configured to use Sphinx and the Myst-parser to build my documentation. The build is fine and everything works (my conf.py in sphinx is OK).

Now, I use VSCode as an editor and I would like to have a "live preview" in vscode for my "myst-flavored" markdown files. This means the preview should be the result of a sphinx build of my myst-markdown files.

In vscode I've found the following extensions:

  • lextudio.restructuredtext which offers a live preview for rst files and use Sphinx under the hood. Moreover, it should use my own conf.py file, so I think it could use the myst-parser as well.
  • MyST-Markdown (executablebookproject.myst-highlight) which offers syntax highlighting and directive autocomplete for "myst-flavored" markdown

But I could not find how to "execute" the live preview of restructuredtext extension on my myst-markdown files.

When I open a markdown file, I can only launch the "markdown preview", for standard markdown, but I cannot execute the restructuredtext preview (via the sphinx build).

How to use restructuredtext extension on myst-markdown files?

N.B: I already have the sphinx-autobuild server settup and working (the "dev" server), but find it not handy to preview in the browser instead of vscode directly. Moreover I wanted the preview only of the file being written...

Mathias Rime
  • 21
  • 1
  • 2
  • 1
    I don't think anything does what you want. `conf.py` is used exclusively by Sphinx, whereas almost all `.rst` preview apps do not use `conf.py` and use other tools to render the HTML. – Steve Piercy Apr 30 '21 at 07:33
  • @StevePiercy the restructuredtext extension seems to use [Sphinx and the `conf.py` file](https://docs.restructuredtext.net/articles/configuration.html#conf-py-path) , so I thought if my build works with the sphinx-autobuild server with myst-parser for markdown file, it should work in this extension. However, I cannot even init/launch the preview of the extension, since i have a .md file and not a .rst file.... – Mathias Rime May 03 '21 at 10:03
  • Don't assume the extension does that. Verify it. I have never seen a server that does that. I have only seen preview servers render simple reST without cross-references between documents or only docutils directives. – Steve Piercy May 03 '21 at 19:05
  • MyST is not supported by this VS Code extension. It might be supported, however, if one day esbonio language implements MyST support. – Lex Li Dec 14 '22 at 07:08

0 Answers0