Skip to content
Newer
Older
100644 104 lines (70 sloc) 3.23 KB
fb220e4 rename project to "md2man": better reflect purpose
Suraj N. Kurapati authored Dec 6, 2011
1 md2man - write UNIX man pages in Markdown
432cfdf rename project to Redman; rewrite from scratch
Suraj N. Kurapati authored Nov 5, 2011
2 ==============================================================================
22daadf @vmg Add sample Manpage renderer
vmg authored Aug 4, 2011
3
fb220e4 rename project to "md2man": better reflect purpose
Suraj N. Kurapati authored Dec 7, 2011
4 md2man is a Ruby library and command-line program that converts [Markdown]
5 documents into UNIX man pages (really [Roff] documents) using [Redcarpet2].
22daadf @vmg Add sample Manpage renderer
vmg authored Aug 4, 2011
6
432cfdf rename project to Redman; rewrite from scratch
Suraj N. Kurapati authored Nov 5, 2011
7 [Roff]: http://troff.org
30fae24 combine: Redcarpet2 + BinMan => redcarpet-manpage
Suraj N. Kurapati authored Oct 13, 2011
8 [Markdown]: http://daringfireball.net/projects/markdown/
9 [Redcarpet2]: https://github.com/tanoku/redcarpet
22daadf @vmg Add sample Manpage renderer
vmg authored Aug 4, 2011
10
30fae24 combine: Redcarpet2 + BinMan => redcarpet-manpage
Suraj N. Kurapati authored Oct 13, 2011
11 ------------------------------------------------------------------------------
12 Installation
13 ------------------------------------------------------------------------------
22daadf @vmg Add sample Manpage renderer
vmg authored Aug 4, 2011
14
30fae24 combine: Redcarpet2 + BinMan => redcarpet-manpage
Suraj N. Kurapati authored Oct 13, 2011
15 As a Ruby gem:
22daadf @vmg Add sample Manpage renderer
vmg authored Aug 4, 2011
16
fb220e4 rename project to "md2man": better reflect purpose
Suraj N. Kurapati authored Dec 7, 2011
17 gem install md2man
22daadf @vmg Add sample Manpage renderer
vmg authored Aug 4, 2011
18
30fae24 combine: Redcarpet2 + BinMan => redcarpet-manpage
Suraj N. Kurapati authored Oct 13, 2011
19 As a Git clone:
22daadf @vmg Add sample Manpage renderer
vmg authored Aug 4, 2011
20
fb220e4 rename project to "md2man": better reflect purpose
Suraj N. Kurapati authored Dec 7, 2011
21 git clone git://github.com/sunaku/md2man
22 cd md2man
30fae24 combine: Redcarpet2 + BinMan => redcarpet-manpage
Suraj N. Kurapati authored Oct 13, 2011
23 bundle install
22daadf @vmg Add sample Manpage renderer
vmg authored Aug 4, 2011
24
30fae24 combine: Redcarpet2 + BinMan => redcarpet-manpage
Suraj N. Kurapati authored Oct 13, 2011
25 ------------------------------------------------------------------------------
fb220e4 rename project to "md2man": better reflect purpose
Suraj N. Kurapati authored Dec 7, 2011
26 Command Usage
27 ------------------------------------------------------------------------------
28
29 Read the manual page:
30
31 md2man --help
32
33 ------------------------------------------------------------------------------
34 Library Usage
30fae24 combine: Redcarpet2 + BinMan => redcarpet-manpage
Suraj N. Kurapati authored Oct 13, 2011
35 ------------------------------------------------------------------------------
22daadf @vmg Add sample Manpage renderer
vmg authored Aug 4, 2011
36
432cfdf rename project to Redman; rewrite from scratch
Suraj N. Kurapati authored Nov 5, 2011
37 Use the default renderer:
22daadf @vmg Add sample Manpage renderer
vmg authored Aug 4, 2011
38
fb220e4 rename project to "md2man": better reflect purpose
Suraj N. Kurapati authored Dec 7, 2011
39 require 'md2man'
04d3feb capitalize the "man" in Md2Man for great honor
Suraj N. Kurapati authored Dec 6, 2011
40 your_roff_output = Md2Man::ENGINE.render(your_markdown_input)
22daadf @vmg Add sample Manpage renderer
vmg authored Aug 4, 2011
41
24ef16c split Roff into a module mixin and an Engine class
Suraj N. Kurapati authored Dec 6, 2011
42 Build your own renderer:
22daadf @vmg Add sample Manpage renderer
vmg authored Aug 4, 2011
43
fb220e4 rename project to "md2man": better reflect purpose
Suraj N. Kurapati authored Dec 7, 2011
44 require 'md2man'
04d3feb capitalize the "man" in Md2Man for great honor
Suraj N. Kurapati authored Dec 7, 2011
45 engine = Redcarpet::Markdown.new(Md2Man::Engine, your_options_hash)
24ef16c split Roff into a module mixin and an Engine class
Suraj N. Kurapati authored Dec 7, 2011
46 your_roff_output = engine.render(your_markdown_input)
22daadf @vmg Add sample Manpage renderer
vmg authored Aug 4, 2011
47
24ef16c split Roff into a module mixin and an Engine class
Suraj N. Kurapati authored Dec 7, 2011
48 Define your own renderer:
49
50 require 'md2man'
51
04d3feb capitalize the "man" in Md2Man for great honor
Suraj N. Kurapati authored Dec 7, 2011
52 class YourManpageRenderer < Md2Man::Engine
24ef16c split Roff into a module mixin and an Engine class
Suraj N. Kurapati authored Dec 7, 2011
53 # ... your stuff here ...
54 end
55
56 engine = Redcarpet::Markdown.new(YourManpageRenderer, your_options_hash)
57 your_roff_output = engine.render(your_markdown_input)
58
59 Mix-in your own renderer:
60
61 require 'md2man'
62
63 class YourManpageRenderer < Redcarpet::Render::Base
04d3feb capitalize the "man" in Md2Man for great honor
Suraj N. Kurapati authored Dec 7, 2011
64 include Md2Man::Roff
432cfdf rename project to Redman; rewrite from scratch
Suraj N. Kurapati authored Nov 5, 2011
65 # ... your stuff here ...
66 end
ea1b9f6 indent paragraphs beginning with defn-indent line
Suraj N. Kurapati authored Nov 2, 2011
67
24ef16c split Roff into a module mixin and an Engine class
Suraj N. Kurapati authored Dec 7, 2011
68 engine = Redcarpet::Markdown.new(YourManpageRenderer, your_options_hash)
69 your_roff_output = engine.render(your_markdown_input)
22daadf @vmg Add sample Manpage renderer
vmg authored Aug 4, 2011
70
30fae24 combine: Redcarpet2 + BinMan => redcarpet-manpage
Suraj N. Kurapati authored Oct 13, 2011
71 ------------------------------------------------------------------------------
fb220e4 rename project to "md2man": better reflect purpose
Suraj N. Kurapati authored Dec 7, 2011
72 Document Format
30fae24 combine: Redcarpet2 + BinMan => redcarpet-manpage
Suraj N. Kurapati authored Oct 13, 2011
73 ------------------------------------------------------------------------------
22daadf @vmg Add sample Manpage renderer
vmg authored Aug 4, 2011
74
475797b indented paragraphs != tagged paragraphs
Suraj N. Kurapati authored Dec 6, 2011
75 md2man attaches the following additional semantics to its [Markdown] input:
76
77 * Paragraphs whose lines are all uniformly indented by two spaces are
78 considered to be "indented paragraphs". They are unindented accordingly
79 before emission as `.IP` in the [Roff] output.
80
81 * Paragraphs whose subsequent lines (all except the first) are uniformly
82 indented by two spaces are considered to be a "tagged paragraphs". They
83 are unindented accordingly before emission as `.TP` in the [Roff] output.
22daadf @vmg Add sample Manpage renderer
vmg authored Aug 4, 2011
84
432cfdf rename project to Redman; rewrite from scratch
Suraj N. Kurapati authored Nov 5, 2011
85 ------------------------------------------------------------------------------
86 Limitations
87 ------------------------------------------------------------------------------
22daadf @vmg Add sample Manpage renderer
vmg authored Aug 4, 2011
88
fb220e4 rename project to "md2man": better reflect purpose
Suraj N. Kurapati authored Dec 7, 2011
89 At present, md2man does not translate the following [Redcarpet2] node types:
22daadf @vmg Add sample Manpage renderer
vmg authored Aug 4, 2011
90
432cfdf rename project to Redman; rewrite from scratch
Suraj N. Kurapati authored Nov 5, 2011
91 * `block_html`
92 * `strikethrough`
93 * `superscript`
94 * `image`
95 * `raw_html`
22daadf @vmg Add sample Manpage renderer
vmg authored Aug 4, 2011
96
432cfdf rename project to Redman; rewrite from scratch
Suraj N. Kurapati authored Nov 5, 2011
97 It issues a warning when it encounters these instead. Patches are welcome!
22daadf @vmg Add sample Manpage renderer
vmg authored Aug 4, 2011
98
30fae24 combine: Redcarpet2 + BinMan => redcarpet-manpage
Suraj N. Kurapati authored Oct 13, 2011
99 ------------------------------------------------------------------------------
100 License
101 ------------------------------------------------------------------------------
22daadf @vmg Add sample Manpage renderer
vmg authored Aug 4, 2011
102
30fae24 combine: Redcarpet2 + BinMan => redcarpet-manpage
Suraj N. Kurapati authored Oct 13, 2011
103 Released under the ISC license. See the LICENSE file for details.
Something went wrong with that request. Please try again.