Markdown Disallowed Raw HTML#
| Item | Description |
|---|---|
| Extension ID | markdown-disallow-raw-html |
| GFM Extension Status | Official |
| Configuration Item | extensions.markdown-disallow-raw-html.enabled |
| Default Value | False |
Configuration#
| Prefixes |
|---|
extensions.markdown-disallow-raw-html. |
| Value Name | Type | Default | Description |
|---|---|---|---|
enabled |
boolean |
False |
Whether the extension is enabled. |
change_tag_names |
string |
`` | See Below |
Summary#
This extension follows the GitHub Flavored Markdown
specifications
for the
marking of certain HTML tag names as disallowed. Once marked as disallowed, the
HTML tag will have the leading character < changed to < to prevent it from
being rendered as a HTML tag by browsers.
Examples#
With this extension enabled and default configuration, the following Markdown text:
```Markdown
```
produces the following html:
HTML
<script>hljs.highlightAll();</script>
which renders as:
<script>hljs.highlightAll();
Specifics#
As noted on the GitHub Flavored Markdown page:
These tags are chosen in particular as they change how HTML is interpreted in a way unique to them (i.e. nested HTML is interpreted differently), and this is usually undesirable in the context of other rendered Markdown content.
Basically, if you allow those tags to occur within documents, they will affect any tags within their hierarchy, whether generated by the Markdown transformer or placed within the document as explicit HTML.
Therefore, this extension provides for the ability to prevent a set of HTML tags from appearing in generated documents as proper HTML. The initial set of these (case insensitive) tag names is:
- title
- textarea
- style
- xmp
- iframe
- noembed
- noframes
- script
- plaintext
Configuring Tags to Disallow#
This set of tag names can be modified by using the change_tag_names configuration
property for the extension. This property takes a comma-separated list of tag names
with each tag name starting with a - character or a + character. For example,
to modify the list to remove the style tag name and to add the something tag
name, the extensions.markdown-disallow-raw-html.change_tag_names configuration
value would be set to: -style,+something.
json
{
"extensions" : {
"markdown-disallow-raw-html" : {
"change_tag_names": "-style,+something"
}
}
}