Hi Khaled, I took a look at the lunamark code, and ran it on some (copied) sample. As it was much slower than I'd expected from lpeg I messed around a little and could bring down the runtime on the sample from 2 sec to 0.1 sec. Anyhow, there is room for improvement so I wonder If I should take the code, wrap it up a bit, and make a module so that we can directly process markdown in context. (Of course we then need to keep an eye on how the original develops, if mkdown develops at all.) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Tue, Jul 19, 2011 at 7:05 AM, Hans Hagen
Hi Khaled,
I took a look at the lunamark code, and ran it on some (copied) sample. As it was much slower than I'd expected from lpeg I messed around a little and could bring down the runtime on the sample from 2 sec to 0.1 sec. Anyhow, there is room for improvement so I wonder If I should take the code, wrap it up a bit, and make a module so that we can directly process markdown in context. (Of course we then need to keep an eye on how the original develops, if mkdown develops at all.)
Markdown, in its official form, does not seem to evolve very much. However, there are extensions to the original syntax, such as those provided by Pandoc (including nice new reference functionalities) and also the Python Markdown processor. Anyway, this is great news! Can't wait to see it in action :)
On Tue, Jul 19, 2011 at 04:05:13PM +0200, Hans Hagen wrote:
Hi Khaled,
I took a look at the lunamark code, and ran it on some (copied) sample. As it was much slower than I'd expected from lpeg I messed around a little and could bring down the runtime on the sample from 2 sec to 0.1 sec. Anyhow, there is room for improvement so I wonder If I should take the code, wrap it up a bit, and make a module so that we can directly process markdown in context. (Of course we then need to keep an eye on how the original develops, if mkdown develops at all.)
That would be great! That was my intent when I started hacking lunamrk to include a ConTeXt writer, by due to lack of time I never managed to do the ConTeXt module part. Regards, Khaled -- Khaled Hosny Egyptian Arab
On 19-7-2011 7:08, Khaled Hosny wrote:
On Tue, Jul 19, 2011 at 04:05:13PM +0200, Hans Hagen wrote:
Hi Khaled,
I took a look at the lunamark code, and ran it on some (copied) sample. As it was much slower than I'd expected from lpeg I messed around a little and could bring down the runtime on the sample from 2 sec to 0.1 sec. Anyhow, there is room for improvement so I wonder If I should take the code, wrap it up a bit, and make a module so that we can directly process markdown in context. (Of course we then need to keep an eye on how the original develops, if mkdown develops at all.)
That would be great! That was my intent when I started hacking lunamrk to include a ConTeXt writer, by due to lack of time I never managed to do the ConTeXt module part.
Ok, I'll give it a try and you can do the checking. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Am 19.07.2011 um 19:14 schrieb Hans Hagen:
On 19-7-2011 7:08, Khaled Hosny wrote:
On Tue, Jul 19, 2011 at 04:05:13PM +0200, Hans Hagen wrote:
Hi Khaled,
I took a look at the lunamark code, and ran it on some (copied) sample. As it was much slower than I'd expected from lpeg I messed around a little and could bring down the runtime on the sample from 2 sec to 0.1 sec. Anyhow, there is room for improvement so I wonder If I should take the code, wrap it up a bit, and make a module so that we can directly process markdown in context. (Of course we then need to keep an eye on how the original develops, if mkdown develops at all.)
That would be great! That was my intent when I started hacking lunamrk to include a ConTeXt writer, by due to lack of time I never managed to do the ConTeXt module part.
Ok, I'll give it a try and you can do the checking.
Can you then also add a few features: - Headings use \startstructurelevel - Paragraphs are enclosed in startparagraph/stopparagraph - emphasis and bold styles use \definehiglight command to make it possible to change the layout of markdown documents where ConTeXt is only used to produce a PDF. Wolfgang
On 19-7-2011 7:25, Wolfgang Schuster wrote:
Can you then also add a few features:
- Headings use \startstructurelevel - Paragraphs are enclosed in startparagraph/stopparagraph - emphasis and bold styles use \definehiglight command
to make it possible to change the layout of markdown documents where ConTeXt is only used to produce a PDF.
I uploaded a beta with a markdown module. Not being a user myself I leave it to others to provide documentation and examples. \starttext \startmarkdown % some examples needed \stopmarkdown \stoptext The code is derived from luamark (but a few 100% faster so I might have messed up). And of course, being the markdown evangelist, John will answer all questions. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Am 20.07.2011 um 14:24 schrieb Hans Hagen:
On 19-7-2011 7:25, Wolfgang Schuster wrote:
Can you then also add a few features:
- Headings use \startstructurelevel - Paragraphs are enclosed in startparagraph/stopparagraph - emphasis and bold styles use \definehiglight command
to make it possible to change the layout of markdown documents where ConTeXt is only used to produce a PDF.
I uploaded a beta with a markdown module. Not being a user myself I leave it to others to provide documentation and examples.
\starttext \startmarkdown % some examples needed \stopmarkdown \stoptext
m-markdown.mkiv \definedelimitedtext [markdownblockquote] - [markdownquotation] + [quotation] % blockquote How about a parameter to change the output of the rule: %\unexpanded\def\markdownrule % {\hairline\par} \unexpanded\def\markdownrule {\markdownparameter\c!rule} Wolfgang
On 21-7-2011 9:31, Wolfgang Schuster wrote:
%\unexpanded\def\markdownrule % {\hairline\par}
\unexpanded\def\markdownrule {\markdownparameter\c!rule}
or maybe better \startsetups markdown:rule \hairline \par \stopsetups \unexpanded\def\markdownrule {\directsetup{markdown:rule}} ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Am 21.07.2011 um 22:58 schrieb Hans Hagen:
On 21-7-2011 9:31, Wolfgang Schuster wrote:
%\unexpanded\def\markdownrule % {\hairline\par}
\unexpanded\def\markdownrule {\markdownparameter\c!rule}
or maybe better
\startsetups markdown:rule \hairline \par \stopsetups
\unexpanded\def\markdownrule {\directsetup{markdown:rule}}
\setupmarkdown[rule=\...] would fir better in the normal setup concept of ConTeXt but as this would be the only setting for \setupmarkdown it can wait till John had more time to play with the module and find missing features. Wolfgang
participants (4)
-
Hans Hagen
-
John Haltiwanger
-
Khaled Hosny
-
Wolfgang Schuster