An HTML server for a static site with Markdown files.
- CSS 80.9%
- JavaScript 14.5%
- HTML 4.6%
| demo | Updated demo and README.md | |
| readme-media | Screenshot | |
| templates | Correct breadcrumb | |
| 404.html | revert to basic 404.html | |
| chmark.css | Initial upload #1 | |
| chmark.js | Improved breadcrumb | |
| favicon.png | Initial upload #2 | |
| index.md | Added link to repo in index.md | |
| LICENSE | Initial upload #1 | |
| marked.min.js | Initial upload #2 | |
| README.md | update README.md | |
chmark
An HTML server for a static site with Markdown files.
Basicaly
Store your Markdown text directly on your web server and let the client browsers display it as appropriate.
Simple to use and no need to process the Markdown text to generate the html files before putting them on your server.
Installation
Untar the ball in a folder /chmark at the document root of your web server.
What chmark displays
chmark example page screenshot
chmark displays:
- the rendered markdown code
- the first level title (ie. the first # or the first === underline) as the tab title
- on top of the page: the page breadcrumb
- on top right, and as the tab icon, the site icon that you can change to yours
Usage
chmark has 3 options of usage, which all display the Markdown in the same way, but with a slightly different technique.
- option A: Drop your .md file directly on your web server, and in the same folder, add a copy of the file
/templates/template-option-A.htmlwith the same name as the .md file, but with the extension.html. - option B: Copy the file
/templates/template-option-B.htmlto another .html file, at the place you want, with the name you want, and, in it, insert your raw markdown text at the place it is commented. - option C: Replace the default 403 and 404 .html error files of your web server by a copy of the file
/404.html. Just drop your raw .md files on your web server and make sure that there is no .html file on the same folder with the same main name part.
As a summary:
| Option | Pros | Cons |
|---|---|---|
| A | Plain .md file | But each .md file needs to be paired with a .html file (which is how ever very light) |
| B | Only one file per page | But it is a .html file: the Markdown text is not in plain .md file |
| C | Only one file per page and it is a plain .md file | But it returns, by design, a hidden 404 error code |
Example
This site is powered by chmark: https://chtixof.codeberg.page
and, in it, there is this demo of the 3 options.
Credits
- The parsing by itself is done by the engine of marked - a markdown parser from Christopher Jeffrey (MIT Licensed).
- The css code is derived from the one of Markdown Viewer / Browser Extension from simo (MIT Licensed).
Updates
2025年09月02日: improved algo to get the md file