#!/usr/bin/env ruby =begin ======================================================================= # MD2MAN-HTML 1 2018-02-04 5.1.2 ## NAME md2man-html - convert md2man(5) flavored [Markdown] text into HTML ## SYNOPSIS `md2man-html` [*OPTION*]... [*FILE*] ## DESCRIPTION This program converts the md2man(5) flavored [Markdown] text from the given *FILE* into HTML and then prints the result to the standard output stream. If *FILE* is not given, then the standard input stream is read in its place. ### Top-level headings Each component of the `.TH` directive in roff(7), described under "Top-level headings" in md2man(5), is wrapped in stylable `<span>` elements as follows: ```html <span class="md2man-title">...</span> <span class="md2man-section">...</span> <span class="md2man-date">...</span> <span class="md2man-source">...</span> <span class="md2man-manual">...</span> ``` ### Heading permalinks Self-referencing hyperlinks (for permanent linking) are added to headings by converting their labels into URI fragments that are unique (using a counter), lowercase, and squeezed and stripped of HTML tags and non-word characters. For example, a heading labeled `Ver<s>iON 3(2</s>!4)))` would be emitted as: ```html <h2 id="ver-ion-3-2-4">Ver<s>iON 3(2</s>!4)))<a name="ver-ion-3-2-4" href="#ver-ion-3-2-4" class="md2man-permalink" title="permalink"></a></h2> ``` For example, multiple headings labeled `Hello, world!` would be emitted as: ```html <h2 id="hello-world">Hello, world!<a name="hello-world" href="#hello-world" class="md2man-permalink" title="permalink"></a></h2> <h2 id="hello-world-1">Hello, world!<a name="hello-world-1" href="#hello-world-1" class="md2man-permalink" title="permalink"></a></h2> <h2 id="hello-world-2">Hello, world!<a name="hello-world-2" href="#hello-world-2" class="md2man-permalink" title="permalink"></a></h2> ``` ### Cross references Cross references to manual pages are emitted as HTML hyperlinks that have `class="md2man-reference"` and `href="../man$SECTION/$PAGE.$SECTION.html"` attributes. For example, the `printf(3)` cross reference would be emitted as this HTML: ```html <a class="md2man-reference" href="../man3/printf.3.html">printf(3)</a> ``` ## OPTIONS `-h` [*PATTERN*], `--help` [*PATTERN*] Show this help manual and optionally search for *PATTERN* regular expression. ## SEE ALSO md2man-roff(1), md2man-rake(1), md2man(5), [Markdown] [Markdown]: http://daringfireball.net/projects/markdown/syntax =end ========================================================================= require 'binman' BinMan.help require 'md2man/html/engine' puts Md2Man::HTML::ENGINE.render(ARGF.read)