Le 16/01/2026 à 12:46, Didier Kryn a écrit :
> Le 16/01/2026 à 11:36, onefang a écrit :
>>> I noticed from markdown documents I
>>> wrote, that the markdown utility found on the Devuan/Debian repository does
>>> not produce correct HTML. It misses at least the <!DOCTYPE HTML>, <html> and
>>> <body> tags at the begining, and </body> and </html> at the end.
>> Did you try pandoc? Or perhaps you needed a template with those bits?
>>
>> The Devuan wiki useshttps://github.com/jgm/lunamark from a Lua script
>> for generating the HTML. That does use a template for those bits.
>>
>> Pandoc is also used on the wiki, it's versatile.
>
> Can do it by hand; I have written a script to invoke a browser
> with a modified file, to check my own README.md files.
>
> #!/bin/sh
> tmpfile=$(mktemp /tmp/abc-script.XXXXXX.htm)
> exec 3>"$tmpfile"
> printf '<!DOCTYPE HTML>\n<html>\n' >&3
> printf '<head>\n<meta http-equiv=\"Content-Type\"' >&3
> printf ' content=\"text/html; charset=utf-8\">\n' >&3
> printf '</head>\n<body>\n' >&3
> markdown $1 >&3
> printf '</body>\n</html>\n' >&3
> palemoon "$tmpfile"
> rm "$tmpfile"
>
> But the "bible" file is a bit larger than my README.md files, and
> I'm not sure it's fully correct and, very importantly, self contained.
> Going to try your and other's suggestions.
>
> -- Didier
>
>
Tried the README.md file transformed by markdown and then added
missing header and trailer tags. It ends up in a readable HTML file, but
- The internal links don't work -- didn't investigate why, but should be
possible to correct.
- It is full of references to images from the github repository, so
that, even when the HTML is local, it needs the connection to github to
render.
This is the kind of HTML document which requires a companion directory
containing lots of png images. It can probably be assembled locally but
would be a pain to do. Not the kind of job I'll do.
I hold for self-contained documents. The fashion of HTML files requiring
lots of other files (mostly images) to render, is very bad practice. To
make a self-contained -- that is portable -- HTML document:
- put the css style in the header, or inline.
- inline images, either as embeded SVG or as base64.
- have table-of-contents and/or index links refer to anchors within the
same file.
- link to an external source only explicitely and when it makes sense:
when it is another document, not just for rendering.
Or make PDF documents.
-- Didier