【问题标题】:I want to post my 'raw code' at 'Markdown'我想在“Markdown”发布我的“原始代码”
【发布时间】:2020-07-06 01:06:56
【问题描述】:

我想发布我的“原始代码”,但它没有。 我输入了我的“html 代码”,但它显示了我的网址。

我使用 Jekyll 主题“中等”。

原始代码

<div style="text-align: center;">
  <a href="http://hits.dwyl.com/{{ site.url | remove_first: 'https://' | remove_first: 'http://' }}{{ page.url }}" target="_blank">
    <img src="http://hits.dwyl.com/{{ site.url | remove_first: 'https://' | remove_first: 'http://' }}{{ page.url }}.svg"/>
  </a>
</div>

页面展示

<div style="text-align: center;">
  <a href="http://hits.dwyl.com/localhost:4000/GithubBlog_8/" target="_blank">
    <img src="http://hits.dwyl.com/localhost:4000/GithubBlog_8/.svg" />
  </a>
</div>

如何发布我的原始代码以及为什么会这样?
这是我的页面和代码。

Github Page
Repository

【问题讨论】:

  • 我想这比last time...稍微清晰...你问如何添加代码块?
  • 感谢您的建议。但我已经知道如何添加代码块。我的问题的答案是'液体原始标签'......!

标签: html markdown jekyll liquid syntaxhighlighter


【解决方案1】:

这取决于你所说的 raw 是什么意思,但我想,在这里你不希望你的液体标签被解释。

在这种情况下,您只需要使用raw 标签即可。

{% raw %}
<div style="text-align: center;">
  <a href="http://hits.dwyl.com/{{ site.url | remove_first: 'https://' | remove_first: 'http://' }}{{ page.url }}" target="_blank">
    <img src="http://hits.dwyl.com/{{ site.url | remove_first: 'https://' | remove_first: 'http://' }}{{ page.url }}.svg"/>
  </a>
</div>
{% endraw %}

另一方面,如果你的意思是 HTML 不应该被你的浏览器处理,那么你需要使用 HTML pre 标签:

<pre>
  <div style="text-align: center;">
    <a href="http://hits.dwyl.com/{{ site.url | remove_first: 'https://' | remove_first: 'http://' }}{{ page.url }}" target="_blank">
      <img src="http://hits.dwyl.com/{{ site.url | remove_first: 'https://' | remove_first: 'http://' }}{{ page.url }}.svg"/>
    </a>
  </div>
</pre>

然后,当然,如果你不需要被处理,你可以将两者结合起来:

{% raw %}
<pre>
  <div style="text-align: center;">
    <a href="http://hits.dwyl.com/{{ site.url | remove_first: 'https://' | remove_first: 'http://' }}{{ page.url }}" target="_blank">
      <img src="http://hits.dwyl.com/{{ site.url | remove_first: 'https://' | remove_first: 'http://' }}{{ page.url }}.svg"/>
    </a>
  </div>
</pre>
{% endraw %}

【讨论】:

  • 是的,我阅读了“液体”官方文件。但我错过了“原始”标签。我添加了“原始”标签,所以效果很好。谢谢你的回答! :)
猜你喜欢
  • 2010-10-08
  • 2020-07-20
  • 1970-01-01
  • 2021-06-02
  • 2021-06-14
  • 2018-12-27
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多