Can I turn off code blocks in Kramdown?

2019-04-13 00:09发布

Can I turn off code blocks in Jekyll? It would make my .md files more readable.

I have this problem for inline HTML and also for includes.

I use Jekyll to create websites and never want code blocks. Right now I'm putting styling inside of HTML like this:

<div class="coolclass" markdown = 1>
  <div class="anotherClass">stuff </div>

  I **love** markdown
</div>

The <div class="anotherClass">stuff </div> gets interpreted as a code block unless I remove the indenting.

<div class="coolclass" markdown = 1>
<div class="anotherClass">stuff </div>

  I **love** markdown
</div>

I'd like to just turn off code blocks since I won't ever be displaying code.

If kramdown has that option I think jekyll can set it in config like this:

kramdown:
 auto_id_stripping: true
 enable_coderay: false

I tried enable_coderay false by reading the kramdown docs, but that didn't do it.

2条回答
霸刀☆藐视天下
2楼-- · 2019-04-13 00:24

Using two spaces instead of 4 spaces or a tab fixes most of the issues. However things like 'h1' ('#title') need to be at the beginning of a line to work. Not quite there yet...

For including html in markdown files

I'm doing this:

{% capture includeGuts %}
{% include signup-guts.html %} 
{% endcapture %}
{{ includeGuts | replace: '    ', ''}}
查看更多
▲ chillily
3楼-- · 2019-04-13 00:48

Coderay is used only for syntax highlighting and it's already set to false in Jekyll (see Default Configuration here http://jekyllrb.com/docs/configuration/).

I guess what you need is remove_block_html_tags in Kramdown. But it's currently not supported by Jekyll. May be you can try to install Kramdown as a separate gem to include this functionality.

查看更多
登录 后发表回答