[GH-ISSUE #105] MD033 cannot enable inline HTML elements #88

Closed
opened 2026-03-03 01:23:38 +03:00 by kerem · 2 comments
Owner

Originally created by @CollinChaffin on GitHub (Feb 23, 2018).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/105

Okay so I have done my due diligence first here and spent over an hour now trying every combination of the config to simply disable and allow a few inline HTML elements like P so I am opening this issue to ask for the exact step(s) required to allow simple inline paragraph html images that are wrapped in HTML paragraph etc. and are so common and found in just about every Gihub repo MD file these days.

I added this block to .markdownlint.json just to cover BOTH of the only documented examples I can find, and it still had no impact:

"no-inline-html" : {
      "allowed_elements" : [ "a", "h1", "h3", "HR", "p" ]
   },
   "MD033": {
	"allowed_elements" : [ "a", "h1", "h3", "HR", "p" ]

Hopefully the documentation showing exactly which config file and syntax to allow inline HTML can then be updated with this information as well. If I have somehow in my exhaustive searching missed an actual working example then I apologize and just need the document location. TIA!

Originally created by @CollinChaffin on GitHub (Feb 23, 2018). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/105 Okay so I have done my due diligence first here and spent over an hour now trying every combination of the config to simply disable and allow a few inline HTML elements like P so I am opening this issue to ask for the exact step(s) required to allow simple inline paragraph html images that are wrapped in HTML paragraph etc. and are so common and found in just about every Gihub repo MD file these days. I added this block to .markdownlint.json just to cover BOTH of the only documented examples I can find, and it still had no impact: ```` "no-inline-html" : { "allowed_elements" : [ "a", "h1", "h3", "HR", "p" ] }, "MD033": { "allowed_elements" : [ "a", "h1", "h3", "HR", "p" ] ```` Hopefully the documentation showing exactly which config file and syntax to allow inline HTML can then be updated with this information as well. If I have somehow in my exhaustive searching missed an actual working example then I apologize and just need the document location. TIA!
kerem 2026-03-03 01:23:38 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@DavidAnson commented on GitHub (Feb 23, 2018):

Here is a working example from the tests to confirm syntax: github.com/DavidAnson/markdownlint@2d8122a3be/test/inline_html-allowed_elements.json

Can you confirm you are using readConfig to pass the parsed .markdownlint.json in via options.config? Or have you tried passing the config directly? The CLI and VS Code extension parse it automatically, but not the programmatic API.

<!-- gh-comment-id:367930375 --> @DavidAnson commented on GitHub (Feb 23, 2018): Here is a working example from the tests to confirm syntax: https://github.com/DavidAnson/markdownlint/blob/2d8122a3bec9d33c55da5620d07901842fb9c92d/test/inline_html-allowed_elements.json Can you confirm you are using `readConfig` to pass the parsed `.markdownlint.json` in via `options.config`? Or have you tried passing the config directly? The CLI and VS Code extension parse it automatically, but not the programmatic API.
Author
Owner

@DavidAnson commented on GitHub (Feb 28, 2018):

Here's an example of this functionality working with released bits:

markdownlint\example>git status
On branch master
Your branch is up to date with 'origin/master'.

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        new file:   .markdownlint.json
        modified:   standalone.js


markdownlint\example>git diff --cached
diff --git a/example/.markdownlint.json b/example/.markdownlint.json
new file mode 100644
index 0000000..73b7010
--- /dev/null
+++ b/example/.markdownlint.json
@@ -0,0 +1,6 @@
+{
+  "default": true,
+  "no-inline-html": {
+    "allowed_elements": [ "p" ]
+  }
+}
diff --git a/example/standalone.js b/example/standalone.js
index dcea2c3..fa73552 100644
--- a/example/standalone.js
+++ b/example/standalone.js
@@ -3,11 +3,10 @@
 var markdownlint = require("../lib/markdownlint");

 var options = {
-  "files": [ "good.md", "bad.md" ],
   "strings": {
-    "good.string": "# good.string\n\nThis string passes all rules.",
-    "bad.string": "#bad.string\n\n#This string fails\tsome rules."
-  }
+    "html": "# Demo\n\ntext <p>text</p> text",
+  },
+  "config": markdownlint.readConfigSync("./.markdownlint.json")
 };

 // Makes a synchronous call, using result.toString for pretty formatting

markdownlint\example>node standalone.js


Results { html: [] }

markdownlint\example>

Please let me know if I've misunderstood the intent.

<!-- gh-comment-id:369125776 --> @DavidAnson commented on GitHub (Feb 28, 2018): Here's an example of this functionality working with released bits: ``` markdownlint\example>git status On branch master Your branch is up to date with 'origin/master'. Changes to be committed: (use "git reset HEAD <file>..." to unstage) new file: .markdownlint.json modified: standalone.js markdownlint\example>git diff --cached diff --git a/example/.markdownlint.json b/example/.markdownlint.json new file mode 100644 index 0000000..73b7010 --- /dev/null +++ b/example/.markdownlint.json @@ -0,0 +1,6 @@ +{ + "default": true, + "no-inline-html": { + "allowed_elements": [ "p" ] + } +} diff --git a/example/standalone.js b/example/standalone.js index dcea2c3..fa73552 100644 --- a/example/standalone.js +++ b/example/standalone.js @@ -3,11 +3,10 @@ var markdownlint = require("../lib/markdownlint"); var options = { - "files": [ "good.md", "bad.md" ], "strings": { - "good.string": "# good.string\n\nThis string passes all rules.", - "bad.string": "#bad.string\n\n#This string fails\tsome rules." - } + "html": "# Demo\n\ntext <p>text</p> text", + }, + "config": markdownlint.readConfigSync("./.markdownlint.json") }; // Makes a synchronous call, using result.toString for pretty formatting markdownlint\example>node standalone.js Results { html: [] } markdownlint\example> ``` Please let me know if I've misunderstood the intent.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/markdownlint#88
No description provided.