doc-html
v0.1.0
Published
For writing an HTML page that can switch between multiple human languages (or multiple programming languages). Also can prettify white spaces in <pre>. Purely browser-side.
Downloads
4
Maintainers
Readme
doc-html
Two features:
- prettify
<pre>
- switch between multiple human languages, or multiple programming languages
If you are writing a manual/documentation of your project but find Markdown is too simple and HTML is too complicated/ugly, you have come to the right place!
Put this before all other script elements:
<script src="doc-html.js" type="text/javascript"></script>
It's fully browser-side. Don't use it for any server-side purposes.
<pre>
indentation
It will detect indentation in <pre>
elements and display them correctly.
<body>
<pre><code>
var a = function() {
alert("something");
};
</code></pre>
</body>
After applying doc-html, the first 8 white spaces in each line will be removed.
Multiple languages
If you want your page to be able to seamlessly switch between English and Chinese, and between JavaScript and CoffeeScript, then you can write:
var naturalLangs = ["en", "zh"];
var programLangs = ["js", "coffee"];
then in a button callback:
setLang("zh", naturalLangs);
in another button callback:
setLang("coffee", programLangs);
All elements with these 4 class names will be toggled.
Real page example
It's used by my "wishlist" tutorial:
Click to see (this HTML page is fully hand-written).