我在 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/