mod_hoedown is Markdown handler module for Apache HTTPD Server.
% git clone --recursive --depth=1 https://github.com/kjdev/apache-mod-hoedown.git
% cd apache-mod-hoedown
% ./autogen.sh (or autoreconf -i)
% ./configure [OPTION]
% make
% make install
Incorporation of external file.
-
--enable-hoedown-url-support
access:
http://localhost/none.md?url=https://raw.github.com/kjdev/apache-mod-hoedown/master/README.md
apache path.
- --with-apxs=PATH
- --with-apr=PATH
- --with-apreq2=PATH
httpd.conf:
LoadModule hoedown_module modules/mod_hoedown.so
<IfModule hoedown_module>
AddHandler hoedown .md
# <Location /markdown>
# SetHandler hoedown
# </Location>
</IfModule
Set the "hoedown" to SetHandler
or AddHander
.
String:
- HoedownDefaultPage
- HoedownDirectoryIndex
- HoedownStylePath
- HoedownStyleDefault
- HoedownStyleExtension
- HoedownClassUl
- HoedownClassOl
- HoedownClassTask
- HoedownTocHeader
- HoedownTocFooter
Numeric:
On/Off:
- HoedownRaw
- HoedownTocUnescape
- HoedownExtSpaceHeaders
- HoedownExtTables
- HoedownExtFencedCode
- HoedownExtFootnotes
- HoedownExtAutolink
- HoedownExtStrikethrough
- HoedownExtUnderline
- HoedownExtHighlight
- HoedownExtQuote
- HoedownExtSuperscript
- HoedownExtLaxSpacing
- HoedownExtNoIntraEmphasis
- HoedownExtDisableIndentedCode
- HoedownExtSpecialAttribute
- HoedownRenderSkipHtml
- HoedownRenderSkipStyle
- HoedownRenderSkipImages
- HoedownRenderSkipLinks
- HoedownRenderExpandTabs
- HoedownRenderSafelink
- HoedownRenderToc
- HoedownRenderHardWrap
- HoedownRenderUseXhtml
- HoedownRenderEscape
- HoedownRenderUseTaskList
- HoedownRenderLineContineu
Raw print support (default: Off).
file: markdown.md
# Header
access: http://localhost/markdown.md?raw
Enable:
# Header
Disable:
<h1>Header</h1>
Markdown extension support (default: Off).
# hoge
#foo
Enable:
<h1>hoge</h1>
<p>#foo</p>
Disable:
<h1>hoge</h1>
<h1>foo</h1>
First Header | Second Header
------------- | -------------
Content Cell | Content Cell
Content Cell | Content Cel
Enable:
<table><thead>
<tr>
<th>First Header</th>
<th>Second Header</th>
</tr>
</thead><tbody>
<tr>
<td>Content Cell</td>
<td>Content Cell</td>
</tr>
<tr>
<td>Content Cell</td>
<td>Content Cel</td>
</tr>
</tbody></table>
Disable:
<p>First Header | Second Header
------------- | -------------
Content Cell | Content Cell
Content Cell | Content Cel</p>
```php
echo "hello world";
```
Enable:
<pre><code class="language-php">echo "hello world";
</code></pre>
Disable:
<p><code>php
echo "hello world";
</code></p>
Footnotes[^1] have a label[^label] and a definition[^!DEF].
[^1]: This is a footnote
[^label]: A footnote on "label"
[^!DEF]: The definition of a footnote.
Enable:
<p>Footnotes<sup id="fnref1"><a href="#fn1" rel="footnote">1</a></sup> have a label<sup id="fnref2"><a href="#fn2" rel="footnote">2</a></sup> and a definition<sup id="fnref3"><a href="#fn3" rel="footnote">3</a></sup>.</p>
-
footer
<div class="footnotes"> <hr> <ol> <li id="fn1"> <p>This is a footnote <a href="#fnref1" rev="footnote">↩</a></p> </li> <li id="fn2"> <p>A footnote on "label" <a href="#fnref2" rev="footnote">↩</a></p> </li> <li id="fn3"> <p>The definition of a footnote. <a href="#fnref3" rev="footnote">↩</a></p> </li> </ol> </div>
Disable:
<p>Footnotes[^1] have a label[^label] and a definition[^!DEF].</p>
<p>[^1]: This is a footnote
[^label]: A footnote on "label"
[^!DEF]: The definition of a footnote.</p>
https://github.com/kjdev
Enable:
<p><a href="https://github.com/kjdev">https://github.com/kjdev</a></p>
Disable:
<p>https://github.com/kjdev</p>
this is ~~good~~ bad.
Enable:
<p>this is <del>good</del> bad.</p>
Disable:
<p>this is ~~good~~ bad.</p>
this is _good_ bad.
Enable:
<p>this is <u>good</u> bad.</p>
Disable:
<p>this is <em>good</em> bad.</p>
this is ==good== bad.
Enable:
<p>this is <mark>good</mark> bad.</p>
Disable:
<p>this is ==good== bad.</p>
this is "good" bad.
Enable:
<p>this is <q>good</q> bad.</p>
Disable:
<p>this is "good" bad.</p>
hoge^(fuga)
hoge ^fuga
hoge ^fu^ga
Enable:
<p>hoge<sup>fuga</sup>
hoge <sup>fuga</sup>
hoge <sup>fu<sup>ga</sup></sup></p>
Disable:
<p>hoge^(fuga)
hoge ^fuga
hoge ^fu^ga</p>
?
hoge_fuga_foo
Enable:
<p>hoge_fuga_foo</p>
Disable:
<p>hoge<em>fuga</em>foo</p>
echo "hoge"
Enable:
<p>echo "hoge"</p>
Disable:
<pre><code>echo "hoge"
</code></pre>
# header {.head #id1}
[kjdev](https://github.com/kjdev){#id2 .link .github}
* item1 {#item1 .item}
* item2 {.hoge #item2 .item}
Enable:
<h1 id="id1" class="head">header</h1>
<p><a href="https://github.com/kjdev" id="id2" class="link github">kjdev</a></p>
<ul>
<li id="item1" class="item">item1</li>
<li id="item2" class="hoge item">item2</li>
</ul>
Disable:
<h1>header {.head #id1}</h1>
<p><a href="https://github.com/kjdev">kjdev</a>{#id2 .link .github}</p>
<ul>
<li>item1 {#item1 .item}</li>
<li>item2 {.hoge #item2 .item}</li>
</ul>
HTML render option (default: Off).
hoge<span>foo</span>
Enable:
<p>hogefoo</p>
Disable:
<p>hoge<span>foo</span></p>
hoge<style>foo</style>
Enable:
<p>hogefoo</p>
Disable:
<p>hoge<style>foo</style></p>
Image: <img src="test.png">
Enable:
<p>Image: </p>
Disable:
<p>Image: <img src="test.png"></p>
Link: <a href="#">here</a>
Enable:
<p>Link: here</p>
Disable:
<p>Link: <a href="#">here</a></p>
Does not use.
[github](https://github.com/kjdev)
[file](file:///local.file)
Enable:
<p><a href="https://github.com/kjdev">github</a>
[file](file:///local.file)</p>
Disable:
<p><a href="https://github.com/kjdev">github</a>
<a href="file:///local.file">file</a></p>
## header2-1
## header2-2
Enable:
<h2 id="header2-1">header2-1</h2>
<h2 id="header2-2">header2-2</h2>
-
toc render:
<ul> <li> <a href="#header2-1">header2-1</a> </li> <li> <a href="#header2-2">header2-2</a> </li> </ul>
Disable:
<h2>header2-1</h2>
<h2>header2-2</h2>
hoge
foo
Enable:
<p>hoge<br>
foo</p>
Disable:
<p>hoge
foo</p>
---
Enable:
<hr/>
Disable:
<hr>
<a href="#">here</a>
Enable:
<p><a href="#">here</a></p>
Disable:
<p><a href="#">here</a></p>
* [ ] task1
* [x] task2
* [ ] task3
Enable:
<ul>
<li><input type="checkbox"> task1</li>
<li><input checked="" type="checkbox"> task2</li>
<li><input type="checkbox"> task3</li>
</ul>
Disable:
<ul>
<li>[ ] task1</li>
<li>[x] task2</li>
<li>[ ] task3</li>
</ul>
hoge
foo
huga
Enable:
<p>hoge foo huga</p>
Disable:
<p>hoge
foo
huga</p>
Required HoedownRenderToc option.
View the table of contents as a header and footer.
Table of contents header.
Table of contents footer.
View the table of contents as a HoedownTocEnd from HoedownTocBegin.
Table of contents begin level (default: 2).
Table of contents end level (default: 6).
# header1
## header2
### header3
#### header4
##### header5
###### header6
default:
<ul>
<li>
<a href="#header2">header2</a>
<ul>
<li>
<a href="#header3">header3</a>
<ul>
<li>
<a href="#header4">header4</a>
<ul>
<li>
<a href="#header5">header5</a>
<ul>
<li>
<a href="#header6">header6</a>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
conf: HoedownTocBegin 1
, HoedownTocEnd 3
<ul>
<li>
<a href="#header1">header1</a>
<ul>
<li>
<a href="#header2">header2</a>
<ul>
<li>
<a href="#header3">header3</a>
</li>
</ul>
</li>
</ul>
</li>
</ul>
conf: HoedownTocHeader '<div class="toc">'
, HoedownTocFooter '</div>'
<div class="toc">
<ul>
<li>
<a href="#header2">header2</a>
<ul>
<li>
<a href="#header3">header3</a>
<ul>
<li>
<a href="#header4">header4</a>
<ul>
<li>
<a href="#header5">header5</a>
<ul>
<li>
<a href="#header6">header6</a>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
You can change the toc range by specifying the toc parameters.
-
http://localhot/markdown.md?toc=3
Same as HoedownTocBegin = 3, HoedownTocEnd = 3.
-
http://localhot/markdown.md?toc=3:5
Same as HoedownTocBegin = 3, HoedownTocEnd = 5.
Table of contents escapel flags.
Required HoedownRenderToc option.
## `Hoge`
## `Foo`
Enable:
<h2 id="-code-hoge--code-"><code>Hoge</code></h2>
<h2 id="-code-foo--code-"><code>Foo</code></h2>
-
toc render:
<ul> <li> <a href="#-code-hoge--code-"><code>Hoge</code></a> </li> <li> <a href="#-code-foo--code-"><code>Foo</code></a> </li> </ul>
Disable:
<h2 id="-code-hoge--code-"><code>Hoge</code></h2>
<h2 id="-code-foo--code-"><code>Foo</code></h2>
-
toc render:
<ul> <li> <a href="#-code-hoge--code-"><code>Hoge</code></a> </li> <li> <a href="#-code-foo--code-"><code>Foo</code></a> </li> </ul>
Set the class attribute of the list.
ul tag class attribute.
* a
default:
<ul>
<li>a</li>
</ul>
conf: HoedownClassUl ul-list
<ul class="ul-list">
<li>a</li>
</ul>
ol tag class attribute.
1. a
default:
<ol>
<li>a</li>
</ol>
conf: HoedownClassUl ol-list
<ol class="ol-list">
<li>a</li>
</ol>
Required HoedownRenderUseTaskList option.
Class attribute of the task list (ex: * [ ]
or * [x]
).
* [ ] a
default:
<ul>
<li><input type="checkbox"/> a</li>
</ul>
conf: HoedownClassUl task-list
<ul class="task-list">
<li><input type="checkbox"/> a</li>
</ul>
Set the style layout file.
Set the style layout file directory path (default: httpd Document root).
Set the style layout file name.
Set the style layout file extension (default: .html).
/var/www/style/default.html:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Markdown Layout</title>
</head>
<body>
</body>
</html>
conf:
HoedownStylePath /var/www/style
HoedownStyleDefault default
HoedownStyleExtension .html
This will expand the markdown file next to the line
with the <body>
of style.html.
- /var/www/style/style.html
- /var/www/style/style-2.html
You can change the layout file by specifying the layout parameters.
-
http://localhot/markdown.md
use style: /var/www/style/default.html
-
http://localhot/markdown.md?style=style
use style: /var/www/style/style.html
-
http://localhot/markdown.md?style=style-2
use style: /var/www/style/style-2.html
You can also send a markdown Markdown content parameter. (Send to POST)
POST http://localhot/markdown.md
form:
<form action="none.md" method="post">
<textarea name="markdown"></textarea>
<input type="submit" />
</form>
none.md does not exists.
Load the content in order.
- A local file
- Markdown Parameters
- URL parameters
Output together.