MyST-Parser icon indicating copy to clipboard operation
MyST-Parser copied to clipboard

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

Open salomon-chung opened this issue 1 year ago • 1 comments

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:

  • https://gitlab.com/uranie-cea/documentation/substitution-in-block/-/blob/main/test.md?ref_type=heads&plain=1
  • https://substitution-in-block-uranie-cea-documentation-de220cba8224ddaf.gitlab.io/test.html

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.

salomon-chung avatar May 24 '24 13:05 salomon-chung

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:

welcome[bot] avatar May 24 '24 13:05 welcome[bot]

Heya, as it mentions on the preview page, this is running the docutils parser, not the sphinx one, and so there is no env (i.e. BuildEnvironment) which a sphinx only thing

chrisjsewell avatar Aug 05 '24 17:08 chrisjsewell