KRAMDOWN(1)

โœจ KRAMDOWN(1) โœจ

okay bestie, come sit, we're doing this ๐Ÿ’– this is the manual page for kramdown, and honestly? it's giving main character energy. everything you'd ever need is in here and we are reading all of it, no skipping, no "tl;dr", we're doing this together ๐Ÿซถ


๐ŸŒธ NAME ๐ŸŒธ

kramdown โ€” a fast, pure-Ruby Markdown-superset converter โœจ


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

kramdown [options] [FILE...]

๐Ÿ‘‘ DESCRIPTION ๐Ÿ‘‘

so, kramdown's whole thing โ€” its literal purpose, its โœจraison d'รชtreโœจ โ€” is parsing a superset of Markdown and converting it into different output formats. It's got standard Markdown in there (with a few minor modifications, ngl), plus a whole bunch of extensions like tables and definition lists. And because its architecture is modular โ€” we love a modular queen โ€” it can also take in input formats that aren't Markdown at all, for example HTML or Github Flavored Markdown. versatile icon ๐Ÿ’…

If you don't hand it a FILE, kramdown just reads from the standard input. And the result? Goes straight to standard output. easy peasy, no notes.

There are two sets of options that kramdown accepts:

  1. the first one is the options used directly by the kramdown binary ๐Ÿซก
  2. the second set controls how kramdown parses and converts its input ๐Ÿ‘‘

Default values for that second set? You can set them with YAML, via the configuration file kramdownrc. but okay, listen, some things you need to know, fr fr:

  • configuration option names use underscores, not dashes โ€” dashes are only a thing in the CLI option names
  • boolean options don't have a "no" variant ๐Ÿšซ โ€” they just take a value of true or false
  • this file has to live in XDG_CONFIG_HOME on Linux/Unix, ~/Library/Preferences on macOS, and ~/AppData/Local on Windows.

๐Ÿ’– CLI-ONLY OPTIONS ๐Ÿ’–

these are the ones handled by the binary itself, no cap:

  • -i FORMAT, --input FORMAT โ€” pick your input format ๐Ÿ’… available input formats: kramdown (this is the default, bestie), markdown, or html. And the input format GFM? That one's available through the kramdown-parser-gfm gem โœจ
  • -o FORMAT, --output FORMAT โ€” pick one or more output formats, separated by commas: html (default ๐Ÿฅ‡), kramdown, latex, man, or remove_html_tags. The converter pdf is available through the kramdown-converter-pdf gem.
  • -x EXT, --extension EXT โ€” load one or more extensions ๐Ÿ”Œ the name of the extension should not include the kramdown- prefix โ€” like, just parser-gfm, okay? You can load multiple extensions by separating them with commas.
โš ๏ธ Note: this option has to be used before any other options that rely on the extension already being loaded. order matters bestie, it's giving โœจsequenceโœจ
  • --no-config-file โ€” do not read any configuration file ๐Ÿ™ˆ the default behavior is to check for a configuration file and read it if it exists.
  • --config-file FILE โ€” override the default path and name of the configuration file ๐ŸŽ€
  • -v, --version โ€” show the version of kramdown ๐Ÿ‘‘
  • -h, --help โ€” show the help ๐Ÿ†˜

๐ŸŒˆ KRAMDOWN OPTIONS ๐ŸŒˆ

this is the big one. strap in. every single one of these controls how kramdown parses and converts its input ๐Ÿ’œ

  • --auto-id-prefix ARG โ€” prefix used for automatically generated header IDs ๐Ÿท๏ธ this lets you set a prefix on the auto-generated header IDs so there's no conflict when you render multiple kramdown documents into one output file separately. The prefix should only contain characters that are valid in an ID!

Default: โ€˜โ€™ โ€” Used by: HTML/Latex converter

  • --[no-]auto-id-stripping โ€” strip all formatting from header text for automatic ID generation โœ‚๏ธ if this is true, only the text elements of a header get used for generating the ID later (in contrast to just using the raw header text line).
๐Ÿ’€ heads up: this option will be removed in version 2.0 because this will be the default then.

Default: false โ€” Used by: kramdown parser

  • --[no-]auto-ids โ€” use automatic header ID generation ๐Ÿ†” if this is true, ID values for all headers are automatically generated whenever no ID is explicitly specified.

Default: true โ€” Used by: HTML/Latex converter

  • --entity-output ARG โ€” defines how entities are output ๐ŸŽญ the possible values are:
    • :as_input โ€” entities are output in the same form as found in the input
    • :numeric โ€” entities are output in numeric form
    • :symbolic โ€” entities are output in symbolic form if possible
    • :as_char โ€” entities are output as characters if possible, only available on Ruby 1.9

Default: :as_char โ€” Used by: HTML converter, kramdown converter

  • --footnote-backlink ARG โ€” defines the text that should be used for the footnote backlinks ๐Ÿ”™ the footnote backlink is just text, so any special HTML characters will be escaped. and if that backlink text is an empty string, no footnote backlinks will be generated at all ๐Ÿšซ

Default: '&8617;' โ€” Used by: HTML converter

  • --[no-]footnote-backlink-inline โ€” specifies whether the footnote backlink should always be inline ๐Ÿ“ with the default of false, the footnote backlink gets placed at the end of the last paragraph if there is one, or else an extra paragraph with only the footnote backlink is created. Setting this option to true tries to place the footnote backlink in the last, possibly nested, paragraph or header. If that fails (e.g. in the case of a table), an extra paragraph with only the footnote backlink is created anyway.

Default: false โ€” Used by: HTML converter

  • --footnote-link-text ARG โ€” the text used for the footnote number in a footnote link ๐Ÿ”ข this one lets you add extra text to the footnote link. It should be a format string, and it's passed the footnote number as the only argument to that format string. e.g. [footnote %s] would display as [footnote 1] โœจ

Default: โ€˜%sโ€™ โ€” Used by: HTML

  • --footnote-nr ARG โ€” the number of the first footnote ๐Ÿฅ‡ lets you specify the number used for the first footnote.

Default: 1 โ€” Used by: HTML converter

  • --footnote-prefix ARG โ€” prefix used for footnote IDs ๐Ÿท๏ธ super handy when you're rendering multiple documents into the same output file and you want to avoid duplicate IDs. and yeah โ€” the prefix should only contain characters that are valid in an ID!

Default: โ€˜โ€™ โ€” Used by: HTML

  • --forbidden-inline-options ARG โ€” defines the options that may not be set using the {::options} extension ๐Ÿ™… the value needs to be an array of option names.

Default: [template] โ€” Used by: HTML converter

  • --[no-]header-links โ€” adds anchor tags within headers that can be used to generate permalinks when you're not using a table of contents ๐Ÿ”— the anchor tags are empty, but you can style them to your liking ๐Ÿ’…

Default: false

  • --header-offset ARG โ€” sets the output offset for headers ๐Ÿ“ if this option is c (it may also be negative), then a header with level n will be output as a header with level c+n. If c+n is lower than 1, level 1 will be used. If c+n is greater than 6, level 6 will be used. math, but make it slay ๐Ÿงฎ

Default: 0 โ€” Used by: HTML converter, Kramdown converter, Latex converter

  • --[no-]html-to-native โ€” convert HTML elements to native elements ๐Ÿ”„ if this is true, the parser converts HTML elements to native elements. For example, when parsing <em>hallo</em> the emphasis tag would normally be converted to an :html element with tag type :em. But if html_to_native is true, then the emphasis would be converted to a native :em element instead. super useful for converters that can't deal with HTML elements ๐Ÿ™

Default: false โ€” Used by: kramdown parser

  • --latex-headers ARG โ€” defines the LaTeX commands for different header levels ๐Ÿ“œ the commands for header levels one through six can be specified by separating them with commas.

Default: section,subsection,subsubsection,paragraph,subparagraph,subparagraph โ€” Used by: Latex converter

  • --line-width ARG โ€” defines the line width to be used when outputting a document ๐Ÿ“

Default: 72 โ€” Used by: kramdown converter

  • --link-defs ARG โ€” pre-defines link definitions ๐Ÿ”— this one lets you pre-define link definitions. The value needs to be a Hash where the keys are the link identifiers and the values are two-element Arrays with the link URL and the link title. If the value is a String, it has to contain a valid YAML hash, and that hash has to follow the guidelines above ๐Ÿ‘†

Default: {} โ€” Used by: kramdown parser

  • --list-indent ARG โ€” sets the number of spaces to use for list indentation โฃ

Default: 2 โ€” Used by: Kramdown converter

  • --math-engine ARG โ€” set the math engine ๐Ÿงฎ specifies the math engine that should be used for converting math blocks/spans. If this option is set to +nil+, no math engine is used and the math blocks/spans are output as is. Options for the selected math engine can be set with the math_engine_opts configuration option.

Default: mathjax โ€” Used by: HTML converter

  • --math-engine-opts ARG โ€” set the math engine options โš™๏ธ specifies options for the math engine set via the math_engine configuration option. The value needs to be a hash with key-value pairs that are understood by the used math engine.

Default: {} โ€” Used by: HTML converter

  • --[no-]parse-block-html โ€” process kramdown syntax in block HTML tags ๐Ÿงฑ if this is true, the kramdown parser processes the content of block HTML tags as text containing block-level elements. Since this is not wanted normally, the default is false. It's normally better to selectively enable kramdown processing via the markdown attribute โœจ

Default: false โ€” Used by: kramdown parser

  • --[no-]parse-span-html โ€” process kramdown syntax in span HTML tags ๐Ÿงต if this is true, the kramdown parser processes the content of span HTML tags as text containing span-level elements.

Default: true โ€” Used by: kramdown parser

  • --[no-]remove-block-html-tags โ€” remove block HTML tags ๐Ÿ—‘๏ธ if this is true, the RemoveHtmlTags converter removes block HTML tags.

Default: true โ€” Used by: RemoveHtmlTags converter

  • --[no-]remove-line-breaks-for-cjk โ€” specifies whether line breaks should be removed between CJK characters ๐ŸŒ

Default: false โ€” Used by: HTML converter

  • --[no-]remove-span-html-tags โ€” remove span HTML tags ๐Ÿ—‘๏ธ if this is true, the RemoveHtmlTags converter removes span HTML tags.

Default: false โ€” Used by: RemoveHtmlTags converter

  • --smart-quotes ARG โ€” defines the HTML entity names or code points for smart quote output ๐Ÿ’ฌ

The entities you wanna use for โ€” in this exact order โ€” a left single quote, a right single quote, a left double quote and a right double quote get picked by entity name or by code point, and you separate them with commas. That's the whole entire thing, no notes. ๐ŸŽ€

Default: lsquo,rsquo,ldquo,rdquo Used by: HTML/Latex converter


  • --syntax-highlighter ARG โ€” picks the syntax highlighter, obviously ๐Ÿ’…

This is the one that decides who's doing the glow-up on your code blocks and spans. Set it to +nil+ and no syntax highlighting happens at all โ€” bare-faced, we're going natural, and honestly? valid.

Whatever options your chosen highlighter needs go in via the syntax_highlighter_opts configuration option.

Default: rouge Used by: HTML/Latex converter

  • --syntax-highlighter-opts ARG โ€” hands your highlighter its little snack pack ๐Ÿ“

These are the options for whatever highlighter you set with the syntax_highlighter configuration option.

The value has to be a hash with key-value pairs that the highlighter you're actually using understands. It doesn't magically know, bestie โ€” it's gotta be a real hash it gets.

Default: {} Used by: HTML/Latex converter

  • --template ARG โ€” wraps your output in a cute lil outfit ๐ŸŽ€

This is the name of an ERB template file that should wrap the output, or the ERB template itself, right there in the argument.

It's used to wrap your output in an environment so the result can stand on its own as a whole document. Say you've got an HTML template โ€” it supplies the header and body tags so your whole output is a legit, valid HTML file. If you give it no template at all, you just get the converted text and nothing else.

Now here's how it finds the thing, in order, no skipping ๐Ÿ’€:

  1. The template name you gave is tried first.
  2. If that file isn't found, the converter extension gets appended โ€” that's the same extension as the converter name.
  3. If it still can't find it, the template name is treated as a template name that kramdown itself provides (without the converter extension).
  4. If the file is still not found, the template name gets checked for starting with โ€˜string://โ€™ โ€” and if it does, that prefix is removed and the rest is used as the template content.

kramdown ships with a default template named โ€˜documentโ€™ for every single converter, so you're never truly alone. ๐Ÿซถ

Default: โ€˜โ€™ (yes, empty, the void, nothing) Used by: all converters

  • --toc-levels ARG โ€” sets which heading levels make it into the table of contents ๐Ÿ“‹

You list the levels by separating them with commas (like 1,2,3) or you use the range syntax (like 1..3). Only the levels you list get used in the table of contents. That's it, that's the rule.

Default: 1..6 Used by: HTML/Latex converter

  • --[no-]transliterated-header-ids โ€” transliterates the header text before generating the ID โœจ

Only ASCII characters go into header IDs, which is kind of a problem for languages rocking a whole lotta non-ASCII characters. Turn this option on and the header text gets transliterated to ASCII as best as it possibly can be, so the resulting header ID is actually useful instead of cursed.

The stringex library has to be installed for this feature to work at all! No library, no transliteration, periodt.

Default: false Used by: HTML/Latex converter

  • --typographic-symbols ARG โ€” maps typographical symbols to the characters that get output ๐Ÿ”ค

Typographical symbols normally get output as their equivalent Unicode codepoint. But sometimes you want to change that up โ€” usually to fall back to a sequence of ASCII characters instead.

This option is how you do it: you give a mapping from typographical symbol to its output string. For example, the mapping {hellip: ...} would output the standard ASCII representation of an ellipsis. Cute and functional.

The available typographical symbol names are:

  • hellip โ€” ellipsis
  • mdash โ€” em-dash
  • ndash โ€” en-dash
  • laquo โ€” left guillemet
  • raquo โ€” right guillemet
  • laquo_space โ€” left guillemet followed by a space
  • raquo_space โ€” right guillemet preceded by a space

Default: {} Used by: HTML/Latex converter


๐Ÿšฆ EXIT STATUS

The exit status is 0 if no error happened. Otherwise it's 1. That's it. Clean success or a lil snack of failure, no in-between ๐ŸŒˆ


๐Ÿ‘€ SEE ALSO

The kramdown website at http://kramdown.gettalong.org for more information โ€” especially if you wanna know about the supported input syntax. Go read it, it slaps.


๐Ÿ‘‘ AUTHOR

kramdown was written by Thomas Leitner t_leitner@gmx.at .

This manual page was written by Thomas Leitner t_leitner@gmx.at .


and that's the whole page, bestie!! ๐Ÿ’–โœจ This was KRAMDOWN(1) โ€” dated January 2019 โ€” so if you're reading this way later, hi, you're doing amazing, go render some markdown ๐Ÿ’…๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from