Per-Document Settings
Marked will allow certain parameters from a document to be set in MultiMarkdown metadata format (detailed below). You can use these to define characteristics and styles that only affect the current document.
Most MultiMarkdown headers are ignored by the preview, but the following are allowed and affect rendering. You can include other metadata to be rendered in the final output, Marked will just ignore keys not listed below. If you save as HTML and do not include a template, Marked will render all metadata keys as expected.
Metadata format
Metadata is entered at the very top of the Markdown file or immediately following any Yaml headers. They consist of a key, followed by a colon, optional spaces or tabs and the value:
Example metadata: example key
Multiple metadata entries should be on their own lines, but without any line breaks between them. The last metadata entry needs to be followed by a blank line before the start of the document text.
First: this is the first metadata entry
Second: this is the second entry
Third: the last metadata entry
# The beginning of the document text
Marked metadata keys
Per-document styles
The “Marked Style:” key will set a preview style for the document. The value can be the name of a default style or a name or path for any Custom Styles you have defined in the preferences. If this key is found and matches a style that Marked knows about, that style will be used for the preview every time the document containing it is loaded.
Example
Marked Style: Upstanding Citizen
Quotes language
By default, Marked uses English-style quotation marks. You can modify this on a per-document basis with the “Quotes Language:” key. Available languages are:
- dutch * english * french * german * germanguillemets
- swedish
Example
Quotes Language: french
Creates French-language «quotation marks.»
Base header level
You can set the header level that Marked starts counting from with the “Base Header Level:” key. This should be a number 1-6, and will modify the way that “#” headers are rendered. If you set the header level to 3, then what would normally be a first-level header (h1) is rendered as a third-level header (h3), and subsequent headers in the hierarchy are shifted up by 2.
Example
Base Header Level: 3
# This headline will render as an h3
## This headline will be an h4
Renders as:
<h3>This headline will render as an h3</h3>
<h4>This headline will be an h4</h4>
Inserting JavaScript
This specifies data that is included in the <head>
tag of the document. Marked ignores most values for this key, except in full-document output, but will respect scripts included in this manner. Script tags defined here will not be in the header, however, they’ll be appended before the closing </body>
tag. jQuery is already loaded, and you can take advantage of that in any scripts you inject.
Example
XHTML Header: <script>(function($){$('#wrapper').fadeOut();})(jQuery);</script>
-or-
XHTML Header: <script src="myfancyscript.js"></script>