|
| 1 | +--- |
| 2 | +id: MDS041 |
| 3 | +name: no-inline-html |
| 4 | +status: ready |
| 5 | +description: >- |
| 6 | + Raw HTML tags in Markdown are not allowed; use a |
| 7 | + Markdown construct or an mdsmith directive instead. |
| 8 | +--- |
| 9 | +# MDS041: no-inline-html |
| 10 | + |
| 11 | +Raw HTML tags in Markdown are not allowed; use a |
| 12 | +Markdown construct or an mdsmith directive instead. |
| 13 | + |
| 14 | +## Config |
| 15 | + |
| 16 | +Enable with default settings (empty allowlist, |
| 17 | +comments permitted): |
| 18 | + |
| 19 | +```yaml |
| 20 | +rules: |
| 21 | + no-inline-html: true |
| 22 | +``` |
| 23 | +
|
| 24 | +Enable with specific tags allowed: |
| 25 | +
|
| 26 | +```yaml |
| 27 | +rules: |
| 28 | + no-inline-html: |
| 29 | + allow: [kbd, sub, sup] |
| 30 | + allow-comments: true |
| 31 | +``` |
| 32 | +
|
| 33 | +Disable: |
| 34 | +
|
| 35 | +```yaml |
| 36 | +rules: |
| 37 | + no-inline-html: false |
| 38 | +``` |
| 39 | +
|
| 40 | +### Settings |
| 41 | +
|
| 42 | +| Setting | Type | Default | Description | |
| 43 | +|------------------|-----------------|---------|--------------------------------------------------------| |
| 44 | +| `allow` | list of strings | `[]` | Tag names that are permitted (replaces, not appended). | |
| 45 | +| `allow-comments` | bool | `true` | Whether HTML comments (`<!-- ... -->`) are allowed. | |
| 46 | + |
| 47 | +## Examples |
| 48 | + |
| 49 | +### Bad |
| 50 | + |
| 51 | +<?include |
| 52 | +file: bad/inline-span.md |
| 53 | +wrap: markdown |
| 54 | +?> |
| 55 | + |
| 56 | +```markdown |
| 57 | +# Title |
| 58 | +
|
| 59 | +text <span>x</span> text |
| 60 | +``` |
| 61 | + |
| 62 | +<?/include?> |
| 63 | + |
| 64 | +### Good |
| 65 | + |
| 66 | +<?include |
| 67 | +file: good/allowed-tag.md |
| 68 | +wrap: markdown |
| 69 | +?> |
| 70 | + |
| 71 | +```markdown |
| 72 | +# Title |
| 73 | +
|
| 74 | +Press <kbd>Enter</kbd> to continue. |
| 75 | +``` |
| 76 | + |
| 77 | +<?/include?> |
| 78 | + |
| 79 | +## What is not flagged |
| 80 | + |
| 81 | +- Fenced and indented code blocks containing HTML |
| 82 | +- Inline code spans |
| 83 | +- Autolinks (`<https://example.com>`) |
| 84 | +- mdsmith directives (`<?name ... ?>`) — block forms |
| 85 | + are parsed as `ProcessingInstruction` nodes; inline |
| 86 | + forms are skipped because they start with `<?` |
| 87 | +- HTML entities in text (`&`, `—`) |
| 88 | +- Closing tags (`</div>`) — the matching opening tag |
| 89 | + already produced a diagnostic |
| 90 | + |
| 91 | +## Meta-Information |
| 92 | + |
| 93 | +- **ID**: MDS041 |
| 94 | +- **Name**: `no-inline-html` |
| 95 | +- **Status**: ready |
| 96 | +- **Default**: disabled (opt-in) |
| 97 | +- **Fixable**: no |
| 98 | +- **Implementation**: |
| 99 | + [source](./) |
| 100 | +- **Category**: meta |
0 commit comments