首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Jekyll Kramdown # (H1)不格式化为标题

Jekyll Kramdown # (H1)不格式化为标题
EN

Stack Overflow用户
提问于 2022-05-02 07:16:17
回答 1查看 143关注 0票数 0

我对Jekyll和kramdown是新手,所以我可能需要帮助来问我的问题。

我在H1标题上遇到了问题:所以在一篇文章中(标记文件在这里下载)中有以下内容:

代码语言:javascript
运行
复制
# H1 looks like this
## H2 looks like this
### H3 looks like this
#### H4 looks like this
##### H5 looks like this
###### H6 looks like this
Normal text looks like this

生成以下内容:

H2-H6看起来很好,但我不知道H1有什么问题,但我希望它的格式正确。

Gemfile

代码语言:javascript
运行
复制
source "https://rubygems.org"

gem "jekyll", ">= 3.8.5"

group :jekyll_plugins do
  gem "jekyll-feed", "~> 0.12"
  gem "jekyll-paginate", "~> 1.1.0"
  gem "jekyll-sitemap"
end

platforms :mingw, :x64_mingw, :mswin, :jruby do
  gem "tzinfo", "~> 1.2"
  gem "tzinfo-data"
end

gem "wdm", ">= 0.1.1" if Gem.win_platform?

gem "webrick"

_config.yml文件

代码语言:javascript
运行
复制
# Build settings
markdown: kramdown
permalink: pretty

highlighter: rouge
kramdown:
  input: GFM
  auto_ids: true
  syntax_highlighter: rouge

HTML是这样的。全HTML文件下载

代码语言:javascript
运行
复制
<h1 id="h1-looks-like-this">H1 looks like this</h1>
<h2 id="h2-looks-like-this">H2 looks like this</h2>
<h3 id="h3-looks-like-this">H3 looks like this</h3>
<h4 id="h4-looks-like-this">H4 looks like this</h4>
<h5 id="h5-looks-like-this">H5 looks like this</h5>
<h6 id="h6-looks-like-this">H6 looks like this</h6>
<p>Normal text looks like this</p>

main.css文件是这里h1多次出现,摘录如下:

代码语言:javascript
运行
复制
h1, h2, h3, h4, h5, h6 { font-size: 100%; font-weight: 400; }

...

.home h1 { margin-bottom: 25px; }

...

.post-header h1 {
  font-size: 36px;
  letter-spacing: -1.75px;
  line-height: 1;
  font-weight: 300;
}

...

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
  line-height: 1;
  font-weight: 300;
  margin: 40px 0 20px;

...

  .post-header h1 { font-size: 36px; }
  .post-content h2 { font-size: 28px; }
  .post-content h3 { font-size: 22px; }
  .post-content h4 { font-size: 18px; }
  .post-content blockquote { padding-left: 10px; }
  .post-content ul,
  .post-content ol { padding-left: 10px; }
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-05-02 13:23:01

您的问题在css中,它指定了以下内容

代码语言:javascript
运行
复制
.post-content h2 {
  font-size: 32px;
  letter-spacing: -1.25px;
}

对于H2,H3,H4,而不是H1。

只要在CSS文件中的..post内容H1中添加H1,就可以了。

我建议学习使用浏览器的检查器来发现这样的问题。只需右键单击页面中的一个元素,然后选择“检查”。那就从那儿走吧。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72083441

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档