Search code examples
jekyllliquid

Jekyll, embed html as string


I have a html snippet in a markdown file in jekyll, the problem is that when it gets parsed, liquid tries to parse it, is there anyway I can tell liquid not to parse a specific line or block?

public render() {
  <ExifOrientationImg markdown="span" src={img} style={{ height: '100%', width: '100%', objectFit: 'cover' }} />
}

throws:

    Liquid Warning: Liquid syntax error (line 25): Expected end_of_string but found colon in "{{ height: '100%', width: '100%', objectFit: 'cover' }}" in /Users/osp/dev/githubpage/_posts/2019-08-27-react-rotating-image.md
    Liquid Warning: Liquid syntax error (line 63): Expected end_of_string but found colon in "{{width: '100%', height: '100%', display: 'flex', alignItems: 'center', justifyContent: 'center'}}" in /Users/osp/dev/githubpage/_posts/2019-08-27-react-rotating-image.md
    Liquid Warning: Liquid syntax error (line 86): Expected end_of_string but found colon in "{{maxWidth: '100%', maxHeight: '100%'}}" in /Users/osp/dev/githubpage/_posts/2019-08-27-react-rotating-image.md
                    ...done in 0.138611 seconds.```

Solution

  • The {% raw %} liquid tag disables Liquid parsing :

    {% raw %}
    public render() {
      <ExifOrientationImg markdown="span" src={img} style={{ height: '100%', width: '100%', objectFit: 'cover' }} />
    }
    {% endraw %}