Closed super119 closed 10 years ago
What error did you get? Do you want to see the actual liquid tags in your final output, or to render them?
You can check the blog here:
http://markzhang.cn/blog/2013/11/05/add-uyan-comment/
Sorry it doesn't have an English version, but you just need to care about the code I pasted in the blog.
The problem is, if I paste this code inside the blog, the build error occurs(check below). Now I paste the code by using {% include_code %}, just as I mentioned previously.
## Generating Site with Jekyll
unchanged sass/screen.scss
Configuration from /work/markz/Projects/blog/_config.yml
Building site: source -> public
Liquid Exception: if tag was never closed in 2013-11-05-add-uyan-comment.markdown
/home/markz/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/liquid-2.3.0/lib/liquid/block.rb:88:in `assert_missing_delimitation!'
/home/markz/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/liquid-2.3.0/lib/liquid/block.rb:49:in `parse'
/home/markz/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/liquid-2.3.0/lib/liquid/tag.rb:10:in `initialize'
/home/markz/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/liquid-2.3.0/lib/liquid/tags/if.rb:24:in `initialize'
/home/markz/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/liquid-2.3.0/lib/liquid/block.rb:28:in `new'
/home/markz/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/liquid-2.3.0/lib/liquid/block.rb:28:in `parse'
/home/markz/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/liquid-2.3.0/lib/liquid/document.rb:5:in `initialize'
/home/markz/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/liquid-2.3.0/lib/liquid/template.rb:58:in `new'
/home/markz/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/liquid-2.3.0/lib/liquid/template.rb:58:in `parse'
/home/markz/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/liquid-2.3.0/lib/liquid/template.rb:46:in `parse'
/home/markz/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/jekyll-0.12.0/lib/jekyll/convertible.rb:79:in `do_layout'
/work/markz/Projects/blog/plugins/post_filters.rb:167:in `do_layout'
/home/markz/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/jekyll-0.12.0/lib/jekyll/post.rb:195:in `render'
/home/markz/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/jekyll-0.12.0/lib/jekyll/site.rb:200:in `block in render'
/home/markz/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/jekyll-0.12.0/lib/jekyll/site.rb:199:in `each'
/home/markz/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/jekyll-0.12.0/lib/jekyll/site.rb:199:in `render'
/home/markz/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/jekyll-0.12.0/lib/jekyll/site.rb:41:in `process'
/home/markz/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/jekyll-0.12.0/bin/jekyll:264:in `<top (required)>'
/home/markz/.rbenv/versions/1.9.3-p0/bin/jekyll:23:in `load'
/home/markz/.rbenv/versions/1.9.3-p0/bin/jekyll:23:in `<main>'
Build Failed
Ah! I see the problem.
Your code contains a Liquid if
tag. What you need to do in order to print liquid (i.e. not render it), is put it in a raw
block:
{% highlight diff %}
{% raw %}
...
{% endraw %}
{% endhighlight %}
(The highlight
tag assumes that you wish to highlight your code and is only one way of doing so)
Oh~ It works, despite the hightlight of diff seems not working. Big thanks parkr.
Hi Parkr, I did another test:
{% raw %}
blablabla...
{% endraw %}
This also works, except there are 2 blank lines at the beginning and the bottom of the output(guess it's created by raw & endraw?). And this has syntax highlighting.
You can also move the raw
tags to outside the triple backticks. That should remove the blank lines at the start and end.
Yeah, it works. Thanks.
Hi Parkr, just a stupid question: I wrote a blog which want to embed some liquid codes(with triple backtick) in it, but I got an error when doing
rake generate
.So it seems that liquid engine treats the code I embedded as liquid codes. How to handle that? Finally I save the codes into a file and use
{% include_code xxx %}
to get through.BTW: Don't know whether it's OK to ask questions here, let me know if I'm wrong.