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

mdformat breaks Hugo shortcodes by escaping < #402

Open
jamesbraza opened this issue Jun 19, 2023 · 5 comments
Open

mdformat breaks Hugo shortcodes by escaping < #402

jamesbraza opened this issue Jun 19, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@jamesbraza
Copy link

jamesbraza commented Jun 19, 2023

Describe the bug

context

Running mdformat on a Markdown file with a Hugo shortcode.

expectation

I expected mdformat to not break the shortcode.

bug

Instead mdformat is breaking the shortcode by escaping < to \<.

problem

This breaks the shortcode for Hugo users.

Relevant Hugo comment: #112 (comment)

Reproduce the bug

{{< youtube -dJolYw8tnk >}}

That links to this YouTube video. mdformat corrects this to

{{\< youtube -dJolYw8tnk >}}

List your environment

mdformat==0.7.16
mdformat-frontmatter==2.0.1
@jamesbraza jamesbraza added the bug Something isn't working label Jun 19, 2023
@welcome
Copy link

welcome bot commented Jun 19, 2023

Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗

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! 🎉

@Oliver-Habersetzer
Copy link

I agree this can be annoying. Also "[" and "]" are escaped - so I can't use this for Obsidian. I might make a PR so we're able to configure this behavior.

@BartKeulen
Copy link

I just want to add another case. I am using mkdocs with PyMarkdown Extension Snippets; useful for embedding content directly in your documentation pages.

A document is included using the following syntax:

--8<-- "filename.ext"

mdformat changes it to:

--8\<-- "filename.ext"

The behavior does not happen inside a code block, the following code is not changed:

\```yaml
--8<-- "filename.yml"
\```

(had to add the escape characters to display it kind of correctly, lol).

@ALizarazoTellez
Copy link

ALizarazoTellez commented Nov 27, 2023

GitHub blocks highlights are escaped too: https://github.com/orgs/community/discussions/16925

Changes:

> [!NOTE]
> Test

With:

> \[!NOTE\] Test

And changes:

> **Note**
> This is a note

With:

> **Note** This is a note

@PythonFZ
Copy link

Any updates on this?

PythonFZ added a commit to zincware/ZnDraw that referenced this issue Feb 14, 2024
PythonFZ added a commit to zincware/ZnDraw that referenced this issue Feb 14, 2024
* mark jobs as failed on restart

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* test the startup db functions

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update README.md

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* remove mdformater

remove because of executablebooks/mdformat#402

* Update README.md

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Zills <46721498+PythonFZ@users.noreply.github.com>
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

5 participants