Closed jimmybutton closed 1 year ago
I've got the same issue when using React code with a style tag , e.g.
```javascript
function App() {
return (
<div style={{padding: "16px"}}> // <- this line causes the issue
...
</div>
);
}
Error:
TemplateSyntaxError at /articles/my-article.md
Could not parse the remainder: '</span><span class="nx">padding</span><span class="o">:</span><span class="w"> </span><span class="s2">"16px"</span><span class="p">' from '</span><span class="nx">padding</span><span class="o">:</span><span class="w"> </span><span class="s2">"16px"</span><span class="p">'
@jimmybutton using the built in django template tag verbatim seems to solve the issue, put it around your code block.
{% verbatim %}
<!-- templates/home.html -->
{% extends 'base.html' %}
{% endverbatim %}
{% verbatim %}
function App() {
return (
<div style={{padding: "16px"}}> // <- this line causes the issue
...
</div>
);
}
{% endverbatim %}
I wonder if I could automatically put {% verbatim %}
when I see code fences (i.e. the three back ticks) when I'm parsing markdown content. Does that seem useful?
@Tobi-De Many thanks, works like a charm!
I wonder if I could automatically put
{% verbatim %}
when I see code fences (i.e. the three back ticks) when I'm parsing markdown content. Does that seem useful?
yep, absolutely
I wonder if I could automatically put
{% verbatim %}
when I see code fences (i.e. the three back ticks) when I'm parsing markdown content. Does that seem useful?
Sounds useful, I agree.
This has been added to 0.20.0 which I just published. Please upgrade, remove your manual verbatim
templatetags, and hopefully it should work for you. Closing for now, but feel free to re-open if you run into problems.
Hi there, I'm getting a TemplateSyntaxError when I'm trying to use Django template tags in a code block in a markdown file, e.g.
Any ideas how I could escape the Django template tag, but still display the correct syntax in the resulting html file?