Search code examples
htmlmarkdownjekyllliquidsyntaxhighlighter

I want to post my 'raw code' at 'Markdown'


I want to post my 'raw code' but it doesn't. I put my 'html code' but it shows my url.

I use Jekyll theme 'Mediumish'.

Raw Code

<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>

Page show

<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>

How can I post my raw code and why it does?
Here is my page & code.

Github Page
Repository


Solution

  • This depends what you means by raw, but I guess, here that you don't want your liquid tags to be interpreted.

    In this case, you just need to use the raw tag.

    {% 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 %}
    

    On the other hand if you mean that the HTML should not be processed by your browser, then you need to use the HTML pre tag:

    <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>
    

    And then, of course, if you need neither to be processed, you can combine both:

    {% 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 %}