-
Notifications
You must be signed in to change notification settings - Fork 198
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
Add substitution syntax(?) #172
Comments
Here's the relevant bit from the rST docs: https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#substitution-definitions Also - just to clarify, the configuration with |
Thanks @SG-phimeca, yes this syntax is not (currently) implemented in MyST (or in markdown). It is a syntax that has come up before in discussion here: #31 (comment) |
I wonder if we could piggy-back on E.g. support something like:
and then allow for |
I'm very sceptical that this could be done in a way that didn't break commonmark compatibility 🤔 |
+1 for the standard Our particular use-case involves the rST substitution syntax in code-blocks to keep example code up-to-date. Unfortunately not having this syntax is blocking me from switching our documentation over to MyST. However, playing around with it, I found if you do:
Sphinx throws a |
👍 I have worked around the problem using sphinx-jinja, but of course it's not ideal, since sphinx-jinja lacks an inline syntax for simple one-word substitutions. So definitely looking forward to some implementation of substitutions. Why not use {sub} |
of course we'd also need a special sub directive to define the substitution, but I assume that would be doable, unless of course my rst fu is failing me and you cannot have a role and directive with the same name. (then we'd use another name?) |
Hi @mgielda what a surprise to find you here :) https://jinja.palletsprojects.com/en/2.11.x/templates/#variables You can wrap your whole document into the jinja directive with 'foo' argument and then in the body just use {{bar}} Which then almost looks like inline one-word substitution |
See https://myst-parser--273.org.readthedocs.build/en/273/using/syntax-optional.html#substitutions, you can leave your thoughts at #273 |
Note substitutions and prologs are not strictly related, this issue is concerned with substitutions and #270 is specifically for prologs/epilogs |
Adding the following into
conf.py
allows to replace
|xyzzy|
byNothing happens.
in all ReST source files but not in Markdown files.This would be a very useful feature, for instance for inline images, or simply to have a system for macros.
The text was updated successfully, but these errors were encountered: