分享好友 最新动态首页 最新动态分类 切换频道
Documentation
2024-12-26 08:27

The behaviour of kramdown can be adjusted via the available options.

Options can be specified in multiple ways:

On the command line
The binary allows setting any option by using command line switches.

For example, the following command will disable automatic header ID generation and defines the first footnote number as 5:



    

As you can see all underscores in option names have to be replaced with dashes. The built-in help of the binary as well as the man-page show all available options.

Within a kramdown document
By using the special extension syntax, it is possible to set options within a document.

Using the above example, the options would be set like this within a document:


  
Using Ruby code

If you are using kramdown as a library, you can pass any options as second parameter to the method.

Again, using the above example you would initalize the kramdown document class as follows:

Below is a list of all currently available options. Have a look at the documentation of a converter or parser to see directly which options they support!

Prefix used for automatically generated header IDs

This option can be used to set a prefix for the automatically generated header IDs so that there is no conflict when rendering 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

Strip all formatting from header text for automatic ID generation

If this option is , only the text elements of a header are used for generating the ID later (in contrast to just using the raw header text line).

This option will be removed in version 2.0 because this will be the default then.

Default: false
Used by: kramdown parser

Use automatic header ID generation

If this option is , ID values for all headers are automatically generated if no ID is explicitly specified.

Default: true
Used by: HTML/Latex converter

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) or :as_char (entities are output as characters if possible, only available on Ruby 1.9).

Default: :as_char
Used by: HTML converter, kramdown converter

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.

If the footnote backlint text is an empty string, no footnote backlinks will be generated.

Default: ‘&8617;’
Used by: HTML converter

Specifies whether the footnote backlink should always be inline

With the default of false the footnote backlink is placed at the end of the last paragraph if there is one, or 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 this fails (e.g. in the case of a table), an extra paragraph with only the footnote backlink is created.

Default: false
Used by: HTML converter

The text used for the footnote number in a footnote link

This option can be used to add additional text to the footnote link. It should be a format string, and is passed the footnote number as the only argument to the format string. e.g. “[footnote %s]” would display as “[footnote 1]”.

Default: ‘%s’
Used by: HTML

The number of the first footnote

This option can be used to specify the number that is used for the first footnote.

Default: 1
Used by: HTML converter

Prefix used for footnote IDs

This option can be used to set a prefix for footnote IDs. This is useful when rendering multiple documents into the same output file to avoid duplicate IDs. The prefix should only contain characters that are valid in an ID!

Default: ‘’
Used by: HTML

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

Adds anchor tags within headers that can be used to generate permalinks when not using a table of contents.

The anchor tags are empty, but can be styled to your liking.
Default: false

Sets the output offset for headers

If this option is c (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.

Default: 0
Used by: HTML converter, Kramdown converter, Latex converter

Convert HTML elements to native elements

If this option is , the parser converts HTML elements to native elements. For example, when parsing the emphasis tag would normally be converted to an element with tag type . If is , then the emphasis would be converted to a native element.

This is useful for converters that cannot deal with HTML elements.

Default: false
Used by: kramdown parser

Defines the LaTeX commands for different header levels

The commands for the header levels one to six can be specified by separating them with commas.

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

Defines the line width to be used when outputting a document

Default: 72
Used by: kramdown converter

Pre-defines link definitions

This option can be used to 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 the hash has to follow the above guidelines.

Default: {}
Used by: kramdown parser

Sets the number of spaces to use for list indentation

Default: 2
Used by: Kramdown converter

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

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

Process kramdown syntax in block HTML tags

If this option is , 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 . It is normally better to selectively enable kramdown processing via the markdown attribute.

Default: false
Used by: kramdown parser

Process kramdown syntax in span HTML tags

If this option is , the kramdown parser processes the content of span HTML tags as text containing span-level elements.

Default: true
Used by: kramdown parser

Remove block HTML tags

If this option is , the RemoveHtmlTags converter removes block HTML tags.

Default: true
Used by: RemoveHtmlTags converter

Specifies whether line breaks should be removed between CJK characters

Default: false
Used by: HTML converter

Remove span HTML tags

If this option is , the RemoveHtmlTags converter removes span HTML tags.

Default: false
Used by: RemoveHtmlTags converter

Defines the HTML entity names or code points for smart quote output

The entities identified by entity name or code point that should be used for, in order, a left single quote, a right single quote, a left double and a right double quote are specified by separating them with commas.

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

Set the syntax highlighter

Specifies the syntax highlighter that should be used for highlighting code blocks and spans. If this option is set to +nil+, no syntax highlighting is done.

Options for the syntax highlighter can be set with the syntax_highlighter_opts configuration option.

Default: rouge
Used by: HTML/Latex converter

Set the syntax highlighter options

Specifies options for the syntax highlighter set via the syntax_highlighter configuration option.

The value needs to be a hash with key-value pairs that are understood by the used syntax highlighter.

Default: {}
Used by: HTML/Latex converter

The name of an ERB template file that should be used to wrap the output or the ERB template itself.

This is used to wrap the output in an environment so that the output can be used as a stand-alone document. For example, an HTML template would provide the needed header and body tags so that the whole output is a valid HTML file. If no template is specified, the output will be just the converted text.

When resolving the template file, the given template name is used first. If such a file is not found, the converter extension (the same as the converter name) is appended. If the file still cannot be found, the templates name is interpreted as a template name that is provided by kramdown (without the converter extension). If the file is still not found, the template name is checked if it starts with ‘string://’ and if it does, this prefix is removed and the rest is used as template content.

kramdown provides a default template named ‘document’ for each converter.

Default: ‘’
Used by: all converters

Defines the levels that are used for the table of contents

The individual levels can be specified by separating them with commas (e.g. 1,2,3) or by using the range syntax (e.g. 1..3). Only the specified levels are used for the table of contents.

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

Transliterate the header text before generating the ID

Only ASCII characters are used in headers IDs. This is not good for languages with many non-ASCII characters. By enabling this option the header text is transliterated to ASCII as good as possible so that the resulting header ID is more useful.

The stringex library needs to be installed for this feature to work!

Default: false
Used by: HTML/Latex converter

Defines a mapping from typographical symbol to output characters

Typographical symbols are normally output using their equivalent Unicode codepoint. However, sometimes one wants to change the output, mostly to fallback to a sequence of ASCII characters.

This option allows this by specifying a mapping from typographical symbol to its output string. For example, the mapping {hellip: …} would output the standard ASCII representation of an ellipsis.

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 preceeded by a space
最新文章
2024年搜索引擎相关上市公司梳理——概念股名单(12月12日)
  据南方财富网概念查询工具数据显示,搜索引擎上市公司有:  光环新网:从近三年净利润复合增长来看,光环新网近三年净利润复合增长为-31.89%,最高为2021年的8.36亿元。  分立后,中金云网拥有原中金数据下属北京数据中心资产和业
2024十大云电脑品牌排行榜 云电脑排行榜前十名
十大品牌不是评选,十大品牌(品牌榜)是由CN10/CNPP品牌数据研究部门通过资料收集整理,并基于大数据统计及人为根据市场和参数条件变化分析研究而得出,是大数据、云计算、数据统计真实客观呈现的结果。以企业实力、品牌荣誉、网络投票、
Kafka 可视化管理工具 (Kafka Tool - Windows 64位)
Kafka可视化工具是一种用于轻松管理和监视Apache Kafka的应用程序。它提供了一个直观的用户界面,使用户能够更容易地管理和监视Kafka集群。对于Windows平台,有几个流行的Kafka可视化工具可供选择。其中一种是Kafka Tool,它是一个功能强大
2021教资笔试高频考点:直接强化、替代性强化和自我强化
2021教资笔试高频考点:直接强化、替代性强化和自我强化  课程推荐:2021年下半年教师资格证笔试课程⇔教资笔试备考技巧  相关阅读:2021年下半年教资笔试资讯专题⇔2021上半年教资面试成绩  教试笔试资料领取方式:  ①首
Macpro开机白屏解决方法 北京苹果电脑维修店
北京苹果电脑维修网点,Macpro开机白屏维修,北京苹果店建安哦上门维修服务,苹果电脑开机白屏,蓝屏,黑屏维修,苹果笔记本无法开机维修,苹果电脑维修服务商,苹果电脑上门修理北京大拿电脑维修中心,十五年老店,苹果电脑专修,北京实体店,我们有十
Git的安装与简单配置
git教程: https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000 下载地址:https://git-scm.com/  https://gitforwindows.org/    [此后一路NEXT即可]    打开cmd或powershell,
H5实现生成urlscheme并从H5跳转到小程序 h5怎么生成链接啊
最近在工作中遇到了一个功能,需要将我们手机端的H5页面自定义分享到微信朋友、朋友圈、QQ和QQ空间。下面是我自己百度,然后自己亲身测试得到的一个方法;下面分享给大家,相互学习。实现原理:H5的自定义分享需要用到微信公众平台的分享接
maya入门图文教程(maya入门知识)
摘要:maya入门图文教程(maya入门知识),maya教程技巧 1、在做模型之前,尽量找到需要建的模型的详细的图片资料。做较真实模型要导入参考图。用EP曲线工具在侧视图上描出伤齿龙形体侧面的大致轮廓,先做身体部分,头也是个单独较复杂的集合
linux获取root权限_OPPO Reno Ace支持深度测试-支持解锁BL获取root权限啦
由于各种原因,OPPO机型暂时并不能解锁BL,这就导致很多玩机用户无法正常获得root非常不友好。不过OPPO官网还是比较重视用户体验的,推出了深度测试,也就是通过深度测试APP,我们申请解锁BL,等到官
10个Python爬虫入门实例,建议收藏!!(附代码)
带伙伴们学习python爬虫,准备了几个简单的入门实例,分享给大家。 涉及主要知识点: web是如何交互的requests库的get、post函数的应用response对象的相关函数,属性python文件的打开,保存 代码中给出了注释࿰
相关文章
推荐文章
发表评论
0评