[prev in list] [next in list] [prev in thread] [next in thread] 

List:       markdown-discuss
Subject:    Re: Syntax Questions
From:       John MacFarlane <jgm () berkeley ! edu>
Date:       2008-07-22 15:46:42
Message-ID: 20080722154642.GA10016 () berkeley ! edu
[Download RAW message or body]

You can change [peg-markdown] to behave the way you want (without
problems in code blocks) just by adding one line:

--- a/markdown_parser.leg
+++ b/markdown_parser.leg
@@ -384,6 +384,7 @@ Entity =    ( HexEntity | DecEntity | CharEntity )
             { $$ = mk_str(yytext); $$->key = HTML; }
 
 Endline =   TerminalEndline | NormalEndline
+            { $$ = mk_element(LINEBREAK); }
 

[peg-markdown]: http://github.com/jgm/peg-markdown/tree/master

John

+++ Jurgens du Toit [Jul 22 08 12:43 ]:
>    Mmm, yes. Didn't think about that. Another solution would perhaps be to
>    split the string into an array by using the start and end tags of block
>    elements, and then only nl2br specific elements of this array, and then
>    put the string back together again.
> 
>    J
> 
>    On Tue, Jul 22, 2008 at 12:35 PM, Michel Fortin
>    <[1]michel.fortin@michelf.com> wrote:
> 
>      Le 2008-07-22 à 2:47, Jurgens du Toit a écrit :
> 
>        At the end of the day I probably will maintain my own copy, with some
>        changes, of Markdown. I also don't want to break the syntax. One of my
>        previous mails I mentioned a way that makes the Markdown more useable
>        (by
>        being able to usefully use nl2br on the Markdown'ed string) without
>        breaking
>        the syntax or HTML and plain text presentation.
> 
>      Have you considered what will happen to code blocks with `nl2br`? Won't
>      this:
> 
>         <pre><code>function a() {
>             return 1;
>         }</code></pre>
> 
>      be turned into this:
> 
>         <pre><code>function a() {<br />
>             return 1;<br />
>         }</code></pre>
> 
>      effectively doubling the newlines?
> 
>      Michel Fortin
>      [2]michel.fortin@michelf.com
>      [3]http://michelf.com/
> 
>      _______________________________________________
>      Markdown-Discuss mailing list
>      [4]Markdown-Discuss@six.pairlist.net
>      [5]http://six.pairlist.net/mailman/listinfo/markdown-discuss
> 
>    --
>    Jurgens du Toit
>    Cell: +27 83 511 7932
>    Fax: +27 86 503 2637
>    Website: [6]www.jrgns.net
> 
>    If people never did silly things, nothing intelligent would ever get done.
>    - Ludwig Wittgenstein
> 
> References
> 
>    Visible links
>    1. mailto:michel.fortin@michelf.com
>    2. mailto:michel.fortin@michelf.com
>    3. http://michelf.com/
>    4. mailto:Markdown-Discuss@six.pairlist.net
>    5. http://six.pairlist.net/mailman/listinfo/markdown-discuss
>    6. http://www.jrgns.net/

> _______________________________________________
> Markdown-Discuss mailing list
> Markdown-Discuss@six.pairlist.net
> http://six.pairlist.net/mailman/listinfo/markdown-discuss


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic