gfm icon indicating copy to clipboard operation
gfm copied to clipboard

Handle language information

Open maxnoe opened this issue 8 years ago • 1 comments

gfm does not parse the language information correctly for code blocks:

```python
print('Hello World')
```

becomes

<p><code>python\nprint('Hello World')</code></p>

Where it should be

<p><code class="python">\nprint('Hello World')</code></p>

maxnoe avatar Apr 07 '16 18:04 maxnoe

I fixed with:

content = re.sub (r'<p><code>python', r'<pre><code class="python">', content)
content = re.sub (r'</code></p>', r'</code></pre>', content)

However, there is a more serious issue. It can't handle C code blocks - it gets really confused by things like #include<stdio.h> - not found a fix for that yet.

tbedford avatar Apr 13 '19 14:04 tbedford