css - 在新的 CSS 段落选择器中保留 .md 格式
问题描述
在 Hugo 网站的 .css 中,我创建了一个新的选择器来执行 MLA 格式的引用缩进:
.mla-ref {
padding-left: 36px;
text-indent: -36px;
}
这按预期工作,创建了一个悬挂缩进。但是,不应用降价格式。例如,我得到一个带有星号的标题:*Moby Dick*
我可以在上面的 .css 项目中做些什么来保留斜体的降价格式吗?
解决方案
降价到HTML
AFAIK,例如,您不能将输入 markdown 包装到语义部分中,就像使用 straight 一样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>
与那些id
由标题的内容生成的。
我猜这使得编写内容和解析器变得容易,但很难仅对某些元素应用自定义样式。
雨果中的降价
根据配置标记文档, Hugo 0.60+ 使用goldmark作为解析的默认库。Markdown
显然,goldmark 支持自定义属性,但仅适用于标题。
## 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 格式的缩进,或者您需要的不仅仅是一个段落,但希望这能让您走上正确的轨道。
推荐阅读
- flutter - 我有一个关于飞镖功能的基本问题:
- git - 在 Git 中,如何从先前的提交中创建一个分支,并从 master 中删除新的提交?
- angular - Angular:如何从 httpClient 请求中获取参数并用于循环相同的请求
- python - 为什么为第二个实例调用保留默认参数?
- python - PyTorch:检查模型准确性导致“TypeError:‘bool’对象不可迭代。”
- api - 如何确定WEB VSCode(不是桌面VSCode)中的编辑器行高(px)?
- c# - Selenium C#:有没有办法在继续之前等待加载覆盖隐藏?
- python - TypeError: '(slice(1, None, None), 0)' 是无效键。尝试使用其他数据帧的索引将 numpy 数组转换为数据帧
- asp.net-core - 如何发布包含数据库作为可执行文件的 ASP .NET Core 项目
- javascript - 地图中的内联函数