Skip to content
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

parsed-literal environment does not respect leading whitespace #1016

Open
nyoma-diamond opened this issue Jan 20, 2025 · 0 comments
Open

parsed-literal environment does not respect leading whitespace #1016

nyoma-diamond opened this issue Jan 20, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@nyoma-diamond
Copy link

What version of myst-parser are you using?

4.0.0

What version dependencies are you using?

sphinx==8.1.3
sphinx-argparse==0.5.2
sphinx_design==0.6.1
pydata-sphinx-theme==0.16.0
myst-parser==4.0.0
docutils==0.21.2

What operating system are you using?

Windows

Describe the Bug

When attempting to use the parsed-literal directive with MyST, leading whitespace isn't respected as it should be.

For example, attempting to display the following fails:

```{parsed-literal}
123
 23
  3
```

being incorrectly displayed as

123
23
3

This incorrect behavior only occurs with parsed-literal. code and code-block directives behave correctly. This breaks circumstances where parsed-literal is necessary for maintaining whitespace while allowing parseable behavior (e.g., for reference links).

Expected Behavior

Whitespace should be preserved, maintaining parity with reStructuredText. E.g., should be the same as

.. parsed-literal::
    
    123
     23
      3

which produces the following, as desired:

123
 23
  3

To Reproduce

  1. Create a parsed-literal block containing lines with leading whitespace
  2. Build the page
  3. Observe the missing whitespace
@nyoma-diamond nyoma-diamond added the bug Something isn't working label Jan 20, 2025
@nyoma-diamond nyoma-diamond changed the title parsed-literal environment does not respect leading whitespace parsed-literal environment does not respect leading whitespace Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant