[NTG-context] Feature request for export: Interactive Notes

Idris Samawi Hamid ادريس سماوي حامد ishamid at colostate.edu
Sat Apr 25 14:19:14 CEST 2015

Hi Pablo,

On Sat, 25 Apr 2015 03:05:07 -0600, Pablo Rodriguez <oinos at gmx.es> wrote:

> On 04/25/2015 02:36 AM, Idris Samawi Hamid ادريس   سماوي حامد wrote:
>> Dear gang,
>>   I've spent a considerable amount of time over the past month trying to
>>   master the art of xhtml output. We are close to being able to use  
>> ConTeXt
>>   as a replacement for markdown in, e.g., WordPress.
> Hi Idris,
> Markdown or pandoc? Markdown is the markup format, pandoc is the tool.

In this case we're talking about markdown qua source. In the WordPress  
case, pandoc of course is not needed: WP can either use md directly or (as  
I prefer) an editor such as MarkdownPad~2 will export the html for you,  
which you can then paste to WP.

> Replacing pandoc with ConTeXt to generate XHTML or ePub files has a
> downside.
> As far as I know, ConTeXt is much slower for this task.

Absolutely, by far. But see below.

> With a sample
> from pandoc (http://pandoc.org/epub.html#a-real-book), it takes between
> 5 and 3 seconds on my computer (depending whether pandoc is loaded in
> memory or not).

Sure, and as you know I've done an entire small book using pandoc  
(docx->md; then md->epub; md->context->pdf)

> With pandoc you have also more formats to write to.

Yes, but the goal here is much narrower: to use ConTeXt as source. Perhaps  
if pandoc supported ConTeXt input I might have gone that route, but I  
don't see that happening anytime soon...

For simple tasks the markdown/pandoc route is excellent. But as the  
typesetting needs become more advanced (e.g., bibliographies), markdown as  
source makes less and less sense. And pandoc export to epub has  
limitations, as you and I have discussed before.

Yes, the ConTeXt route is slower, and the learning curve has been  
considerably longer than I anticipated. But the resulting workflow is  
*much* more flexible for serious academic typesetting and export tasks.

>>   Indeed, I plan topresent the results of this experiment (porting an
>>   entire academic article to xhtml and WP) in a future article for one  
>> of
>>   the TeX journals...
> I’m really interested in reading it. Also because I’m trying to use
> ConTeXt to generate high-quality PDF documents from XHTML files
> generated by pandoc ;-).

Ah, I'll be interested in seeing that workflow as well ;-)

>>   Now we can of course already export xhtml footnotes from ConTeXt but  
>> there
>>   will be no interactive links. In the current project, there are 77
>>   footnotes; I had to add the links manually to get the output to do  
>> what we
>>   wanted.
> I’m afraid that missing links for footnotes is a bug,

Hmm, what do you mean exactly?

>>   [Also note that it makes much more sense to export the footnotes as
>>   endnotes, particularly for long blog posts.]
> I think that footnotes are related to pages. You can only have proper
> footnotes in a page.

This is why I said that it makes much more sense to export the footnotes  
as endnotes. At the end of, e.g., a blog post you'll have a section for  
footnotes/endnotes. In the context source I had to make a derivative  
version and use something like


[Aside: I wonder if there is a way in ConTeXt to setup \placefootnotes  
etc. in a mode so that it gets invoked only in the export. Will explore  
this for the article.]

Some crude regular expressions helped me to edit ConTeXt's *div.xhtml  
output; with scripting one should be able to do it all automatically. But  
my scripting skill set is limited-to-nonexistent so the part of the task  
that couldn't fit easily into a regex sub I had to do manually.

Best wishes
Idris Samawi Hamid
Professor of Philosophy
Colorado State University
Fort Collins, CO 80523

More information about the ntg-context mailing list