New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I show variables in codeblock? #941

Closed
azone opened this Issue Jan 13, 2013 · 6 comments

Comments

Projects
None yet
3 participants
@azone

azone commented Jan 13, 2013

I want to show the code like this:

<script type="text/javascript" src="{{ root_url }}/javascripts/open-in-blank.js"></script>

but it shows

<script type="text/javascript" src="/javascripts/open-in-blank.js"></script>

in the post. why?

@imathis

This comment has been minimized.

Show comment
Hide comment
@imathis

imathis Jan 13, 2013

Owner

Are you saying that you want liquid variables to be output inside of {% codeblock %} liquid blocks or what? Can you provide a more thorough example, or perhaps point to a sample post where you're running into this problem?

We're trying to use GitHub issues for development and handling support on the Octopress mailing list, so I'm going to go ahead and close this issue too keep issues clean.

Owner

imathis commented Jan 13, 2013

Are you saying that you want liquid variables to be output inside of {% codeblock %} liquid blocks or what? Can you provide a more thorough example, or perhaps point to a sample post where you're running into this problem?

We're trying to use GitHub issues for development and handling support on the Octopress mailing list, so I'm going to go ahead and close this issue too keep issues clean.

@imathis imathis closed this Jan 13, 2013

@azone

This comment has been minimized.

Show comment
Hide comment
@azone

azone Jan 14, 2013

Here is the code in my markdown file:

{% codeblock source/_includes/custom/header.html lang:html %}
<script type="text/javascript" src="{{ root_url }}/javascripts/open-in-blank.js"></script>
{% endcodeblock %}

and the result I posted as image:
 2013-01-14 10 06 04

azone commented Jan 14, 2013

Here is the code in my markdown file:

{% codeblock source/_includes/custom/header.html lang:html %}
<script type="text/javascript" src="{{ root_url }}/javascripts/open-in-blank.js"></script>
{% endcodeblock %}

and the result I posted as image:
 2013-01-14 10 06 04

@monfresh

This comment has been minimized.

Show comment
Hide comment
@monfresh

monfresh Jan 14, 2013

@azone In order to display liquid variables inside a code block, you need to surround them with {% raw %} and {% endraw %}. So, in your case, you want this:
{% raw %}{{ root_url }}{% endraw %}

monfresh commented Jan 14, 2013

@azone In order to display liquid variables inside a code block, you need to surround them with {% raw %} and {% endraw %}. So, in your case, you want this:
{% raw %}{{ root_url }}{% endraw %}

@imathis

This comment has been minimized.

Show comment
Hide comment
@imathis

imathis Jan 14, 2013

Owner

Thanks @monfresh that should do it. Alternatively you can do this

Owner

imathis commented Jan 14, 2013

Thanks @monfresh that should do it. Alternatively you can do this

@azone

This comment has been minimized.

Show comment
Hide comment
@azone

azone Jan 14, 2013

Thanks to @monfresh and @imathis , It works.
P.S. : Google Groups has been blocked in china

azone commented Jan 14, 2013

Thanks to @monfresh and @imathis , It works.
P.S. : Google Groups has been blocked in china

@imathis

This comment has been minimized.

Show comment
Hide comment
@imathis

imathis Jan 14, 2013

Owner

@azone Thanks for letting me know that's too bad. I'm happy to offer support here for those unable to access Google Groups.

Owner

imathis commented Jan 14, 2013

@azone Thanks for letting me know that's too bad. I'm happy to offer support here for those unable to access Google Groups.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment