pikelang / Pike

Pike is a dynamic programming language with a syntax similar to Java and C. It is simple to learn, does not require long compilation passes and has powerful built-in data types allowing simple and really fast data manipulation.
http://pike.lysator.liu.se/
Other
194 stars 34 forks source link

Parser.Markdown: Bogus output when using code fences #40

Closed poppa closed 1 year ago

poppa commented 1 year ago

Bug reported here since it's impossible to bug report at https://git.lysator.liu.se/pikelang/pike/-/issues (WTF)

The following code

constant MD = #"
## Some Stuff

```html

<head></head>

```

Some text post code fence
";

int main(int argc, array(string) argv) {
  string html = Parser.Markdown.parse(MD);
  werror("%s", html);
}

generates the following output:

<h2 id="some-stuff">Some Stuff</h2>
<pre><code class='lang-html'>
&lt;head&gt;&lt;/head&gt;
</code></pre>
&lt;head&gt;&lt;/head&gt;<p>Some text post code fence</p>

But this is what's expected:

<h2 id="some-stuff">Some Stuff</h2>
<pre><code class='lang-html'>
&lt;head&gt;&lt;/head&gt;
</code></pre>
<p>Some text post code fence</p>
grubba commented 1 year ago

Issue copied to https://git.lysator.liu.se/pikelang/pike/-/issues/10107

grubba commented 1 year ago

Fixed.