Wiki export to html
(1) By smartmic on 2020-01-27 20:20:48 [link]
I like the simplicity of Fossil Wiki's markup style and I know about the
fossil wiki export command. It would be really great if this command would allow for an export directly into HTML (maybe some kind of
--html option flag).
My use cases would comprise converting exported HTML page into other markup languages (e.g. via pandoc) and/or directly using wiki pages somewhere else externally, think of blogs or personal websites. This would lead to some ancillary functionality of fossil in the realm of markup conversion, similar to what
fossil test-diff --tk does for file comparison.
I would be even willing to dive into coding myself but I am wondering how this idea is received by the core developers? On the otherhand, writing a custom converter for this bare bone markup would be also not too complex but the functionality is already there somewhere in Fossil' codebase.
That should be a really easy thing to add. It's bedtime here in central Europe, but i will take a look at implementing it tomorrow. The json API can do this, but that's not terribly convenient for shell scripts.
Note, however, that the exports will not contain a complete HTML file with html/body tags because that's not how fossil internally parses wiki pages. Only the contents of the wiki page will get parsed/exported, not the page/skin around it.
Wow, what a quick and positive response! When you have such a committed developer team, my enthusiasm for Fossil grows even more. So first thing: thank you.
I did not know about JSON API but I was also thinking that everything should be there and the simpler the interface, the better.
No problem that we don't get html/body tags, I hadn't thought of that either. My intention is embedding the wiki exports, if I need standalone pages, that is easy to add.
(4) By wyetr on 2020-01-27 21:18:04 in reply to 2
exports will not contain a complete HTML file...not the page/skin around it.
That sounds like a feature if the next step in the chain is
pandoc. You want purely semantic HTML in this case: no CSS, headers, footers, JS, or other clutter.
The only thing that would be nice is if it could give it a minimal amount of syntax clothing:
<html><body>$content</body></html>. Just enough to pass an HTML validator, you know.
It's bedtime here in central Europe, but i will take a look at implementing it tomorrow.
2:30am counts as "tomorrow" :). Here you go:
Regarding the addition of
<html><body> wrapping tags: i started to add that but discovered that the different X-to-html routines handle their output buffer differently, which makes implementing that more work than it should be. Specifically, the markdown-to-html handler clears its output target before outputing the HTML to it (whereas the . This means that the injected opening wrapper tags (when implemented the easy/straightforward way) get deleted, and changing that behaviour may introduce bugs in other uses of that routine. i'm currently working on a solution for that which doesn't require modifying (and thoroughly testing) the markdown-to-html converter.
Regarding the addition of
New flags have been added to support that:
-h|--html The body (only) is rendered in HTML form, without any page header/foot or HTML/BODY tag wrappers. -H|--HTML Works like -h|-html but wraps the output in <html><body>...</body></html>. -p|--pre If -h|-H is used and the page or technote has the text/plain mimetype, its HTML-escaped output will be wrapped in <pre>...</pre>.
We are using Fossil + Pandoc in similar environments. We start by writing together in real time using Markdown/CodiMD, then we export the docs to a Fossil repository and finally we use Pandoc and Grafoscopio to export documents in PDF and HTML. The front page is done in Markdeep using Fossil's embedded documentation
You can see some examples of this workflow in the port of the Data Feminism book and we are explaining the tools and workflow we use in the Documentathon Book (Spanish early draft). For the Grafoscopio documentation, I use Fossil's excellent JSON API to query the repositories where it is located and to select the documents I want to download.
So Fossil is a pretty good tool to keep your documentation in a simple format and to store and publish it, and is pretty good at being integrated with external tools producing several outputs.
I think that you will find Fossil a valuable part of your writing, collaborating and publishing workflow as it has been in our case.