executablebooks / MyST-Parser

An extended commonmark compliant parser, with bridges to docutils/sphinx
https://myst-parser.readthedocs.io
MIT License
704 stars 189 forks source link

Substitution in Block doesn't seem to work in Live Preview #935

Open salomon-chung opened 1 month ago

salomon-chung commented 1 month ago

What version of myst-parser are you using?

3.0.0

What version dependencies are you using?

pyodide-0.21.3

What operating system are you using?

Linux

Describe the Bug

Running the following code gives errors in https://myst-parser.readthedocs.io/en/latest/live-preview.html:

---
myst:
    substitutions:
        key: "I'm a **substitution**"
---
# Test

## Text

{{ key }}

## Code Block

{{
    "```\n" + key + "\n```"
}}

## Code Block + Environment

{{
    "```\n" + env.docname + "\n```"
}}

live-preview

Expected Behavior

Substitution in block seems to work in this MWE:

pages

Is it the expected behaviour?

To Reproduce

  1. Go to https://myst-parser.readthedocs.io/en/latest/live-preview.html
  2. In Configuration (YAML), define:
    myst_enable_extensions:
    - substitution
  3. Copy the previous code.
welcome[bot] commented 1 month ago

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada: