我有一個jekyll站點,我在代碼塊中發佈了很多shell示例。我努力在腳本/ shell命令和它們的命令輸出之間直觀地描述。有不同的風格適用於不同的語法熒光筆語言
生成的HTML:
<pre><code class="language-powershell">
function DemoCode {
return 'rab', 'oof'
}
DemoCode
rab
oof
</code></pre>
在這個例子中,最後兩行需要是明顯從第一4行的輸出。
降價,目前只是正常的三反引號與PowerShell的標籤:
```powershell
function DemoCode {
return 'rab', 'oof'
}
DemoCode
rab
oof
```
我寧願避免它分裂成第二個代碼塊。 Wordpress讓我用內聯樣式標籤做這件事,但它是一份工作。
這不是對我來說是很好的解決方案,但我可以用「明文」標籤的語法高亮一個單獨的代碼塊:
我迄今爲止最好的是確實有獨立的代碼塊。如果我應用'明文'標籤來闖紅燈,那麼至少我不會得到語法突出顯示,這有助於。但生成的html仍然從.highlight繼承相同的CSS。
降價:
```powershell
function Write-Stuff {
Write-Output $Stuff
}
```
```plaintext
Output I would like with different color and background-color
```
我仍然需要繼承不同的CSS,雖然。生成的HTML:
<div class="language-powershell highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">#this is formatted with md code block and powershell tag</span>
</code></pre></div></div>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>#formatted with md code block and plaintext tag
</code></pre></div></div>
爲什麼不使用兩個不同的代碼塊? –
這是一個關於視覺語言的問題。平面設計很重要,兩個獨立的代碼塊不是解決方案。 部分解決方案是,如果第二個代碼塊在視覺上通過例如單獨的顏色進行區分,但我無法在jekyll中找到實現該方法的方法,因爲html類是在提交到github頁面時生成的。 – FSCKur
期望的輸出是什麼?沒有樣式? – marcanuy