Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Markdown Problem

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #46375
    srikarg
    Participant

    Hello everyone,

    I am currently writing a blog post for my website and in the process, encountered a problem with Markdown. The character ‘{‘ is a special character in Markdown as most of you may know. I know that you can escape it using {, but I am trying to include the character in a code block. For example, something like this:


    Your name is {{ name }}

    This ends up completely deleting the {{ characters and everything between them. I tried escaping them, but the character ends up in the code block as well. My question is, how do I escape the { character in a Markdown code block without having the character literally appearing in the code block? Please tell me if this doesn’t make sense or if I need to elaborate. Thanks in advance!

    #142709
    srikarg
    Participant

    Thank you for the answer @traq, but I am still having issues with the blog post. I am using Jekyll and Pygments with Markdown so my code blocks look something like this:

    {% highlight html %}

    This is some code


    {% endhighlight %}

    This will get compiled into a `pre` tag containing a `code` tag containing the actual content of the code block. Based on @traq's advice, I tried abstracting the code block as the following:

    {% highlight html %}

    This is some code


    {% endhighlight %}
    Code tag here. The forums won't let me type them here...{{ name }}

    This doesn't produce the result I want as seen here: http://imgur.com/cDBY6EI. The {{ name }} completely vanishes. It doesn't render.

    I tried using HTML entities for the braces as such: Code tag here{{ user_name }}. This does work, but not as intended: http://imgur.com/TMVBRU5. Is there any way I can get the styling of the code block for the code tags containing the braces? I know that I can use id's and specifically target this one case, but is this the best way to go?

    #142821
    srikarg
    Participant

    The raw tag helped a lot! It works now! Thanks so much @traq! :D

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Other’ is closed to new topics and replies.