在Hugo网站的.css中,我创建了一个新的选择器来执行MLA格式的引用缩进:
.mla-ref {
padding-left: 36px;
text-indent: -36px;
}
这将按预期方式工作,从而产生一个悬挂的缩进。但是,不应用降价格式。例如,我得到的标题带有文字星号:* Moby Dick *
我可以在上述.css项中做一些事情来保留斜体的降价格式吗?
HTML
AFAIK,例如,您不能像直接使用HTML
一样将输入的markdown包装到语义部分中。你从中得到的
# 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>
带有标题内容生成的那些id
。
我想这很容易编写内容和解析器,但是很难仅对某些元素应用自定义样式。
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格式,还需要更多的段落,但希望这能使您走上正确的轨道。