I am developing an JSF web application and would like to introduce a lot of documentation to be visible directly in the web application. Technically I would like to use Markdown language and made already first experimence with. I am currently playing around with flexmark Java library to render e. g. HTML strings from a markdown document. Also this seems to work fine. But what to do with links to other md files?
If I do have my markdown part: See also [here](Background.md)
Then this will be rendered correct to HTML with a link like: See also <a href="Background.md">here</a>
.
But how should I tell my web server to react on this link and update the document part of the page with the rendered md file?
I would need to manually find such links in the generated HTML and change them to a kind of JavaScript call, telling my server to render the panel using the other md file.
Or should I create an IFrame so that within this frame, I could follow the link to e. g. a web servlet, rendering the md files to new HTML?
But this all feels a bit clumbsy to me. Am I missing a more easy solution?
Ok, no other answers, so I answer on my own. The comment about primefaces extension with localized is interesting, but too far away from my focus and some features did not really match to my requirements.
Therefore I stayed with a pure markdown library and made the rest on my own. With the links it was much more easy than expected! Within JavaScript you can very easily detect all links of the page (
document.links
), iterate over them and just set an onclick function (see here).