-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Showdown Options
To learn how to set and get options, please check Showdown's API documentation
type | default | since | description |
---|---|---|---|
boolean | false | 1.0.0 | Omit the trailing newline in a code block |
By default, showdown adds a newline before the closing tags in code blocks. By enabling this option, that newline is removed.
This option affects both indented and fenced (gfm style) code blocks.
input:
var foo = 'bar';
omitExtraWLInCodeBlocks = false:
<code><pre>var foo = 'bar';
</pre></code>
omitExtraWLInCodeBlocks = true:
<code><pre>var foo = 'bar';</pre></code>
type | default | since | description |
---|---|---|---|
boolean | false | 1.1.0 | Disable the automatic generation of header ids |
Showdown generates an id for headings automatically. This is useful for linking to a specific header. This behavior, however, can be disabled with this option.
input:
# This is a header
noHeaderId = false
<h1 id="thisisaheader">This is a header</h1>
noHeaderId = true
<h1>This is a header</h1>
NOTE: Setting to true overrides prefixHeaderId and ghCompatibleHeaderId options
type | default | since | description |
---|---|---|---|
boolean | false | 1.5.5 | Generate header ids compatible with github style |
This changes the format of the generated header IDs: spaces are replaced with dashes and a bunch of non alphanumeric chars are removed.
input:
# This is a header with @#$%
ghCompatibleHeaderId = false
<h1 id="thisisaheader">This is a header</h1>
ghCompatibleHeaderId = true
<h1 id="user-content-this-is-a-header-with-">This is a header with @#$%</h1>
type | default | since | description |
---|---|---|---|
string | boolean | 1.0.0 | Add a prefix to the generated header ids |
Adds a prefix to the generated header ids. Passing a string will prefix that string to the header id. Setting it to true
will add a generic 'section' prefix.
input:
# header
prefixHeaderId = false
<h1 id="header">header</h1>
prefixHeaderId = true
<h1 id="sectionheader">header</h1>
prefixHeaderId = 'my prefix'
<h1 id="myprefixheader">header</h1>