public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: John MacFarlane <fiddlosopher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: markdown writer line wrapping
Date: Sun, 12 Dec 2010 20:38:25 -0800	[thread overview]
Message-ID: <20101213043825.GA12716@protagoras.phil.berkeley.edu> (raw)
In-Reply-To: <20101124032534.GB25133-nFAEphtLEs+AA6luYCgp0U1S2cYJDpTV9nwVQlTi/Pw@public.gmane.org>

+++ John MacFarlane [Nov 23 10 19:25 ]:
> +++ Nathan Gass [Nov 24 10 02:51 ]:
> > Some questions about the line wrapping implementation for the
> > markdown writer.
> > 
> > Is it correct that line wrapping only happens at the top level, so
> > something like *very long emphasized text ... end of it* currently
> > does not get wrapped?
> 
> Right.
> 
> > And how would I go about to implement arbitrary deep line wrapping,
> > so that something like *very long empahsized text [with a very long
> > citation inside for @key p. 10]* gets wrapped correctly?
> > 
> > How does line-wrapping work in pandoc?
> 
> See wrapped in Text.Pandoc.Shared.  (Also wrappedMarkdown in the
> Markdown writer, which handles complications due to line breaks.)
> 
> You're right, it splits an [Inline] by Space at the top level, then applies a
> function [Inline] -> m Doc to the sublists that result, then applies
> fsep (from the PrettyPrint library) to combine the resulting [Doc]
> into a single Doc with line wrapping.
> 
> Unfortunately, I can't see an easy fix (one that doesn't require major
> architectural changes).

I've been working on a small prettyprinting library to use instead
of the one from 'pretty'.  It's designed to be a better fit from pandoc,
and it solves this line wrapping issue.

Unfortunately, it's currently slower than the standard prettyprinting library.
If you want to look at it, it's in the 'pretty' branch of jgm/pandoc on
github.

I haven't worked much yet on optimizing it, and so far I've just worked
it into the markdown writer -- and only incompletely.
Benchmarks show that it's significantly slower than the old version.
33 ms vs 18 ms.

Nonetheless I'm thinking about using it to replace Text.PrettyPrint.HughesPJ
throughout, if it can be optimized a bit...  Right now I'm using DLists;
I might try using Blaze.Builder.

John


  parent reply	other threads:[~2010-12-13  4:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-24  1:51 Nathan Gass
     [not found] ` <4CEC6F95.5000408-8UOIJiGH10pyDzI6CaY1VQ@public.gmane.org>
2010-11-24  3:25   ` John MacFarlane
     [not found]     ` <20101124032534.GB25133-nFAEphtLEs+AA6luYCgp0U1S2cYJDpTV9nwVQlTi/Pw@public.gmane.org>
2010-12-13  4:38       ` John MacFarlane [this message]
2010-12-18 21:46       ` John MacFarlane
     [not found]         ` <20101218214621.GA3416-nFAEphtLEs+AA6luYCgp0U1S2cYJDpTV9nwVQlTi/Pw@public.gmane.org>
2010-12-18 22:58           ` John MacFarlane
     [not found]             ` <20101218225821.GC4805-nFAEphtLEs+AA6luYCgp0U1S2cYJDpTV9nwVQlTi/Pw@public.gmane.org>
2010-12-18 23:46               ` Simon Michael
2010-12-20 18:50               ` BP Jonsson
     [not found]                 ` <4D0FA58A.8090001-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2010-12-20 19:16                   ` John MacFarlane
     [not found]                     ` <20101220191623.GA15603-nFAEphtLEs+AA6luYCgp0U1S2cYJDpTV9nwVQlTi/Pw@public.gmane.org>
2010-12-21  3:50                       ` John MacFarlane
     [not found]                         ` <20101221035024.GA13268-nFAEphtLEs+AA6luYCgp0U1S2cYJDpTV9nwVQlTi/Pw@public.gmane.org>
2010-12-22 18:57                           ` BP Jonsson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101213043825.GA12716@protagoras.phil.berkeley.edu \
    --to=fiddlosopher-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).