降价到HTML
AFAIK,您不能将输入 markdown 包装到语义部分中,例如直接使用 HTML。你得到了什么
# First
This is the first paragraph of the first section.
This is the second paragraph of the first section.
# Second
This is the first paragraph of the second section.
只是一堆
<h1 id="first">First</h1>
<p>This is the first paragraph of the first section.</p>
<p>This is the second paragraph of the first section.</p>
<h1 id="second">Second</h1>
<p>This is the first paragraph of the second section.</p>
用那些ids 生成的标题的内容。
我想,这使得编写内容和解析器变得容易,但很难仅对某些元素应用自定义样式。
Hugo 中的 Markdown
Hugo 0.60+ 使用goldmark 作为解析Markdown 的默认库,根据Configure Markup docs。
显然,goldmark 支持custom attributes,但仅适用于标题。
## heading {#id .className attrName=attrValue class="class1 class2"}
这意味着至少目前,您只能使用 .has-mla-ref 类标记标题,然后将样式应用于直接兄弟。
示例
.has-mla-ref + p {
padding-left: 36px;
text-indent: -36px;
}
### Reference {.has-mla-ref}
Best, David, and Sharon Marcus. “Surface Reading: An Introduction.” Representations, vol. 108, no. 1, Fall 2009, pp. 1-21. JSTOR, doi:10.1525/rep.2009.108.1.1
Onwards with your content, this is not a ref anymore.
我不知道除了缩进之外是否还有更多内容可以使其符合 MLA 格式,或者您是否需要不止一个段落,但希望这能让您走上正确的道路。