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

Indented code blocks with special characters cause an error #31

Closed
pelson opened this issue Jun 10, 2024 · 6 comments · Fixed by #32
Closed

Indented code blocks with special characters cause an error #31

pelson opened this issue Jun 10, 2024 · 6 comments · Fixed by #32
Assignees

Comments

@pelson
Copy link

pelson commented Jun 10, 2024

With mdformat-mkdocs, having indented code with special characters results in a rendering problem:

Error: Could not format "example.md".

The formatted Markdown renders to different HTML than the input Markdown. This
is likely a bug in mdformat. Please create an issue report here, including the
input Markdown: https://github.com/executablebooks/mdformat/issues

The example:

# Title

1.  First step:

     ```bash
     echo \
      <container name>
     ```

I'm on Python 3.11, with:

$ pip list
Package         Version
--------------- -------
linkify-it-py   2.0.3
markdown-it-py  3.0.0
mdformat        0.7.17
mdformat_admon  2.0.3
mdformat-gfm    0.3.6
mdformat_mkdocs 2.1.0
mdformat_tables 0.4.1
mdit-py-plugins 0.4.1
mdurl           0.1.2
more-itertools  10.2.0
uc-micro-py     1.0.3

I also get a warning:

Warning: Plugin conflict. More than one plugin defined a renderer for "link" syntax.

I'm guessing this isn't related, but wish I knew how to remove the warning.

@pelson
Copy link
Author

pelson commented Jun 10, 2024

I should say, there is no problem formatting:

# Title

1.  First step:

     ```bash
     echo \
      "hello world"
     ```

@KyleKing
Copy link
Owner

KyleKing commented Jun 10, 2024

Hm, there is always an edge case with markdown 😅. I partially rely on the core library logic for identifying code blocks, but this is probably something on my end (Update: yep, my logic to ignore HTML within code blocks isn't working. Should be a straightforward fix I can release after work!)

On the warning, that shouldn't cause any issues, but I'm working on a proper fix in an open PR (#30)

@pelson
Copy link
Author

pelson commented Jun 10, 2024

Hm, there is always an edge case with markdown 😅

Indeed 😂

FWIW, this is fine with vanilla mdformat.

@KyleKing
Copy link
Owner

This issue should be fixed with changes from #32 in v2.1.1!

@KyleKing
Copy link
Owner

KyleKing commented Jun 24, 2024

FYI: the warning for multiple definitions of 'href' should now be resolved with v3.0.0!

@pelson
Copy link
Author

pelson commented Jun 27, 2024

Verified with 3.0... it is looking awesome! Thanks for the great project!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants