whitespace at the start of code in a blockquote trimmed

Bram Mertens mertensb.mazda at gmail.com
Wed Aug 16 03:40:52 EDT 2017


Thanks,

The part of Markdown.pl that causes this is in sub _DoBlockQuotes:
[bmertens.LAPTOP085] ➤ diff -u Markdown.pl{.orig,}
--- Markdown.pl.orig
+++ Markdown.pl
@@ -1065,14 +1065,6 @@
                        $bq = _RunBlockGamut($bq);              # recurse

                        $bq =~ s/^/  /g;
-                       # These leading spaces screw with <pre> content, so
we need to fix that:
-                       $bq =~ s{
-                                       (\s*<pre>.+?</pre>)
-                               }{
-                                       my $pre = $1;
-                                       $pre =~ s/^  //mg;
-                                       $pre;
-                               }egsx;

                        "<blockquote>\n$bq\n</blockquote>\n\n";
                }egmx;

I've removed this section and the document I'm working on works fine now.
But the comment suggests that this may introduce problems in other
documents so YMMV.

Regards

Bram

On Mon, Aug 14, 2017 at 4:43 PM Michel Fortin <michel.fortin at michelf.ca>
wrote:

> Looks like a bug in Markdown.pl. Pretty much all the other implementations
> of Markdown handle this correctly. So you can use another Markdown parser,
> or alternatively you can write the whole blockquote in HTML as a
> workaround. I think you can add spaces to all the lines too (so it looks
> better in the text document). Or you take some time to fix Markdown.pl.
>
> > Le 14 août 2017 à 9:03, Bram Mertens <mertensb.mazda at gmail.com> a écrit
> :
> >
> > Hi,
> >
> > In a document I'm writing I wanted to include an extract from an email
> message as a blockquote.
> > The message contains a code extract which contains both a piece of ascii
> art (output from banner) as well as some lines that start with spaces.
> >
> > After converting the markdown to XHTML I noticed that the ascii art does
> not look as expected and some lines that start with spaces are displayed
> left-aligned. (Meaning the leading spaces are removed).
> >
> > The problem occurs only when the blocquote (> ) and code (4spaces) are
> combined.
> > Adding two more spaces somehow resolves the problem as well but that
> obviously makes the Markdown text look different.
> >
> > I've created a small sample and uploaded it to pastebin at
> https://pastebin.com/iCb3ESYZ.
> > It has the original text, the same text without blockquote and the
> version with the additional spaces added.
> > Converting that in dingus (
> https://daringfireball.net/projects/markdown/dingus) demonstrates the
> problem.
> >
> > Is this by design?
> > Is there another way to avoid this?
> >
> > Thanks in advance
> >
> > Bram
> > _______________________________________________
> > Markdown-Discuss mailing list
> > Markdown-Discuss at six.pairlist.net
> > https://pairlist6.pair.net/mailman/listinfo/markdown-discuss
>
> --
> Michel Fortin
> https://michelf.ca
>
> _______________________________________________
> Markdown-Discuss mailing list
> Markdown-Discuss at six.pairlist.net
> https://pairlist6.pair.net/mailman/listinfo/markdown-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist6.pair.net/pipermail/markdown-discuss/attachments/20170816/3db8ee41/attachment.html>


More information about the Markdown-Discuss mailing list