Today I ran into a typical documentation problem.
- Organization uses mainly Word, but I don't use word.
- I want a solution that, while the documents are checked into subversion, is navigable in the browser.
- So, HTML is probably good, but I'm not going to write HTML by hand.
- I don't want any server-side code, and I also don't want to check in 'compiled' HTML.
<div id="content"> <!-- This div contains all content in Markdown. --> Showdown is - legend... - ...wait for it... - ...dary! <!-- End of div with markdown --> </div> <!-- This script translates markdown to readable HTML --> <script src="https://raw.github.com/coreyti/showdown/master/compressed/showdown.js" ></script> <script> var converter = new Showdown.converter(); var content = document.getElementById('content'); console.log(content); content.innerHTML = converter.makeHtml(content.innerHTML); </script>
which gives me a page that says the following,
- ...wait for it...
Isn't that an awesomely simple solution? Just type Markdown in the predefined div, save, commit, and enjoy.
Oh yeah, subversion
When using this solution in Subversion, remember to set the SVN mimetype to text/html, so the file can be viewed in the browser. You can do this using
svn propedit svn:mime-type <file>