Holzhaus / sphinx-multiversion

Sphinx extension for building self-hosted versioned docs.
https://holzhaus.github.io/sphinx-multiversion/
BSD 2-Clause "Simplified" License
148 stars 65 forks source link

Get current version in markdown files #100

Open j2bbayle opened 1 year ago

j2bbayle commented 1 year ago

First of all, thanks a lot for this super-useful package!

I'm currently building a multi-version documentation, mostly written in Markdown using myst-parser. Everything works fine, except that I can't seem to be able to use substitutions (https://myst-parser.readthedocs.io/en/latest/syntax/optional.html#substitutions-with-jinja2) to access the current_version variable.

I've made sure that 'substitution' was in my myst_enable_extensions, and I've tried to use

{{ current_version.name }}

as well as

{{ env.config.current_version.name }}

but none of these are defined.

Is there a way to access this variable (defined in the HTML context)?

Thanks a lot!

skabbit commented 1 year ago

Got the same question regarding current version in rst files.

kbonney commented 1 year ago

Is this what you are looking for: https://holzhaus.github.io/sphinx-multiversion/master/context.html