Arc Forumnew | comments | leaders | submitlogin
Bug in (markdown)
1 point by wfarr 6138 days ago | 4 comments
I'm working on writing a blog in Arc at the moment, and have found an odd bug in markdown. I've also emailed PG about this, but I'm going to post it here as well.

http://dev.compiz-fusion.org:8080/viewpost?id=2

There's a demonstration of the issue. Notice the lack of p tags around the paragraph directly after the pre/code block.



1 point by almkglor 6138 days ago | link

Hmm. Maybe post the original source of the post? I mean the input string to markdown ^^. Kinda hard to parse through markdown without seeing the data it's supposed to be working on.

-----

1 point by wfarr 6138 days ago | link

"Here I am typing normally. Yey, fun, etc.

  (def mycode (goes here)
    (pr "for sure"))
This paragraph isn't wrapped as a paragraph! =(

But this one is! =/"

Where newline's would've been converted to \n, etc.

-----

1 point by almkglor 6138 days ago | link

The bug appears to be that code-block consumes all whitespace after it. However, the paragraph detector expects to see some newlines. Hmm.

-----

1 point by almkglor 6138 days ago | link

Grr. Possibly just have it print </code></pre><p> instead >.<

Edit: Okay. Here's the diff:

  diff --git a/app.arc b/app.arc
  index 912a1ad..8106695 100644
  --- a/app.arc
  +++ b/app.arc
  @@ -421,7 +421,7 @@
                  (do (pr  "<p><pre><code>")
                    (let cb (code-block s (- newi spaces 1))
                      (pr cb)
  -                   (= i (+ (- newi spaces 1) (len cb))))
  +                   (= i (+ (- newi spaces 2) (len cb))))
                    (pr "</code></pre>"))
                  (iflet newi (parabreak s i (if (is i 0) 1 0))
                         (do (unless (is i 0) (pr "<p>"))
Why the change to 2? Because cb itself has a lookahead problem. Or maybe not, grr.

-----