1

我正在使用 Hakyll 构建一个静态网站,并且正在使用 PandocCompiler 将 markdown 编译为 html。这完美地工作,但编译器接受这个:

# Heading 1

并将其编译为

<h1>Heading 1</h1>

这是预期的结果。但是,我想从较低的标题开始,例如 ,<h3>这样:

# Heading 1

编译为

<h3>Heading 1</h3>

还有这个:

## Heading 2

编译为

<h4>Heading 2</h4>

等等。

我当然可以更改 markdown 本身,但我有很多文件,而且工作量很大,而且会让 markdown 有点难看。

关于如何做到这一点的任何想法?

4

1 回答 1

1

The Hakyll.Web.Html module includes some useful functions for HTML manipulation, including a demoteHeaders which should be enough for your needs. It is also worth noting that the withTags function there allows convenient usage of tagsoup for arbitrary manipulation of HTML tags.

于 2015-10-06T18:36:53.470 回答