Jekyll,将 html 嵌入为字符串

标签 jekyll liquid

我在 jekyll 的 markdown 文件中有一个 html 片段,问题是当它被解析时,liquid 尝试解析它,我是否可以告诉 Liquid 不要解析特定的行或 block ?

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

抛出:

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

最佳答案

{% raw %} liquid tag禁用 Liquid 解析:

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

关于Jekyll,将 html 嵌入为字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57737539/

相关文章:

css - Jekyll 页面特定 CSS

css - Jekyll 和 SinglePaged 主题

css - Jekyll - 如何更改 pygments 语法突出显示字体系列?

filter - 在 Liquid 标签中使用过滤器

Jekyll & Liquid : Output category list with post count?

github - Jekyll 与 GitHub Enterprise

ruby - 尝试使用 jekyll 时如何解决此捆绑更新错误?

date - 使用 Shopify Liquid 将日期转换为时间戳

javascript - 选择子元素 jQuery

github - 使用 Jekyll Logic 列出除当前页面之外的所有页面