lowdown icon indicating copy to clipboard operation
lowdown copied to clipboard

Query about metadata

Open leath-dub opened this issue 2 years ago • 1 comments

Hey, first off love this project, great work on this!

Anyhow I using the lowdown library and wonder if there is a way to add metadata that would enable you to prepend and append html to the output. I know that in MultiMarkdown, you have HTML Header and HTML Footer.

If there is no way to do this, is there an alternative solution to the problem ? would you know where I can make a patch in the code ? (where is the metadata handler ?), thanks for your time :).

EDIT: also wonder if there would be a way to override the tags that lowdown adds in, allowing you to provide your own boilerplate

leath-dub avatar Jan 29 '23 19:01 leath-dub

There are such keys in other formatters (e.g., HTML Header), however, they're really poorly thought out: there's no mention as to where in the header they're noted, or whether they replace other media-specific metadata (e.g., title), etc. In general, the metadata concept of markdown is fragmented and poorly documented (with exception to lowdown ofc, which tries hard to document everything).

What I suggest is using lowdown to generate the "body" of the document, then writing your own header and footer and using a Makefile or similar to cat them together . E.g.,

% cat >output.html <<!!
<html>
 <head>
  <title>foo</title>
 </head>
 <body>
!!
% lowdown -thtml yourdoc.md >>output.html
% cat >>output.html <<!!
 </body>
</html>
!!

This can be done using the library by passing FILE pointers and dumping into them before and after the renderer.

kristapsdz avatar May 20 '23 19:05 kristapsdz