mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-04-25 09:16:02 +03:00
[GH-ISSUE #1631] MD033 : Hugo shortcode support #2573
Labels
No labels
bug
enhancement
enhancement
enhancement
fixed in next
fixed in next
fixed in next
new rule
new rule
new rule
pull-request
question
refactoring
refactoring
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/markdownlint#2573
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mysiki on GitHub (Jun 7, 2025).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/1631
Hello,
I have an issue with the Rules MD033 : No inline HTML.
I use Hugo to generate my website, and Hugo allow to use shortcode (which generate HTML result). Shortcode can be call with different method :
{{% shortcode %}}or{{< shortcode >}}. (https://gohugo.io/content-management/shortcodes/#notation)Inside this shortcode, you can define some parameters. And I need to provide argument with "<" inside.
Test code :
It's "strange" because the rule fire on
pattern="<variable>"but not on{{<. It can work by escaping like '<' but this make the content more complex for no reason.I try to check the code, but so far than what I know 😅...
Did you see a way to make the rule work ? Basically,
{{% %}}and{{< >}}should not be considered as html elements. Maybe not as global rule, I'm not sure that this rule should work in no-Hugo site.Maybe by using allowed_elements or improving the new table_allowed_elements to make something like "allow html inside this content" or a new switch special Hugo.
At the end, I don't know why this
{{<do not fire the rule, it's maybe the start point :D.Thanks for your help
@DavidAnson commented on GitHub (Jun 7, 2025):
Assuming there is a typo there, I agree that this rule does not seem appropriate for Hugo syntax. I would suggest disabling the rule for your project or maybe just for files that use that feature.
If Hugo supports directive syntax instead, you should be able to convert to that because it is recognized by the micromark parser: https://github.com/micromark/micromark-extension-directive
@mysiki commented on GitHub (Jun 7, 2025):
Thinking more about that, and look like the problem is rule which is not correct. The rule say "This rule is triggered whenever raw HTML is used in a Markdown document:" or the check is false all 'html like'
<foo>is detected as HTML even if foo is not an HTML word. I will check micromark parser at same time, thanks@DavidAnson commented on GitHub (Jun 7, 2025):
HTML will treat an unrecognized element name as a span. It could also be a custom element. This rule deliberately does not try to filter for element names defined by any specific HTML standard version.
https://developer.mozilla.org/en-US/docs/Learn_web_development/Extensions/Testing/HTML_and_CSS#html_fallback_behavior