簡體   English   中英

Jekyll Kramdown # (H1) 沒有格式化為標題

[英]Jekyll Kramdown # (H1) not formatting as heading

我是 Jekyll 和 kramdown 的新手,所以我可能需要幫助來問我的問題。

我在使用 H1 標題時遇到問題:所以帖子中的以下內容(降價文件下載在這里):

# 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

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文件

# Build settings
markdown: kramdown
permalink: pretty

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

HTML 是這樣的。 HTML文件下載

<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出現了好幾次,摘錄在這里:

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; }
}

您的問題出在 css 中,它指定了類似

.post-content h2 {
  font-size: 32px;
  letter-spacing: -1.25px;
}

對於 H2、H3、H4,但不適用於 H1。

只需添加font-size: 40px; inside.post-content H1 在你的 CSS 文件中,你會沒事的。

我建議學習使用瀏覽器的檢查器來查找此類問題。 只需右鍵單擊頁面中的一個元素,然后 select “檢查”。 然后從那里撥打 go。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM