kramdown-man 0.1.8 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +4 -9
- data/.gitignore +4 -3
- data/.yardopts +1 -1
- data/ChangeLog.md +61 -0
- data/Gemfile +6 -3
- data/LICENSE.txt +1 -1
- data/README.md +156 -57
- data/Rakefile +1 -1
- data/bin/kramdown-man +3 -12
- data/gemspec.yml +7 -0
- data/kramdown-man.gemspec +2 -1
- data/lib/kramdown/man/cli.rb +202 -0
- data/lib/kramdown/{converter/man.rb → man/converter.rb} +328 -89
- data/lib/kramdown/man/task.rb +3 -1
- data/lib/kramdown/man/version.rb +3 -1
- data/lib/kramdown/man.rb +28 -3
- data/man/kramdown-man.1 +203 -101
- data/man/kramdown-man.1.md +102 -27
- data/spec/cli_spec.rb +218 -0
- data/spec/converter_spec.rb +969 -0
- data/spec/{kramdown/document_spec.rb → integration_spec.rb} +3 -3
- data/spec/{kramdown/man_spec.rb → man_spec.rb} +1 -1
- data/spec/spec_helper.rb +2 -0
- metadata +18 -11
- data/spec/kramdown/converter/man_spec.rb +0 -562
data/man/kramdown-man.1
CHANGED
@@ -1,112 +1,194 @@
|
|
1
|
-
.\" Generated by kramdown-man 0.
|
1
|
+
.\" Generated by kramdown-man 1.0.0
|
2
2
|
.\" https://github.com/postmodern/kramdown-man#readme
|
3
|
-
.TH kramdown-man
|
4
|
-
.
|
3
|
+
.TH kramdown-man 1 "April 2013" kramdown-man "User Manuals"
|
4
|
+
.SH SYNOPSIS
|
5
|
+
.PP
|
6
|
+
\fBkramdown-man\fR \[lB]\fIoptions\fP\[rB] \fIMARKDOWN\[ru]FILE\fP
|
5
7
|
.SH DESCRIPTION
|
6
|
-
.LP
|
7
8
|
.PP
|
8
9
|
A Kramdown
|
9
10
|
.UR http:\[sl]\[sl]kramdown\.gettalong\.org\[sl]
|
10
|
-
.UE
|
11
|
-
|
11
|
+
.UE
|
12
|
+
plugin for converting Markdown files into man pages\.
|
13
|
+
.SH ARGUMENTS
|
14
|
+
.TP
|
15
|
+
\fIMARKDOWN\[ru]FILE\fP
|
16
|
+
The input markdown file to convert\.
|
17
|
+
.SH OPTIONS
|
18
|
+
.TP
|
19
|
+
\fB-o\fR, \fB--output\fR \fIOUTPUT\fP
|
20
|
+
The file to write the man page output to\.
|
21
|
+
.TP
|
22
|
+
\fB-V\fR, \fB--version\fR
|
23
|
+
Prints the \fBkramdown-man\fR version\.
|
24
|
+
.TP
|
25
|
+
\fB-h\fR, \fB--help\fR
|
26
|
+
Prints the usage for \fBkramdown-man\fR\.
|
12
27
|
.SH EXAMPLE
|
13
|
-
.
|
14
|
-
|
28
|
+
.PP
|
29
|
+
Render a man page from markdown:
|
30
|
+
.PP
|
31
|
+
.RS 4
|
32
|
+
.EX
|
33
|
+
\[Do] kramdown\-man \-o man\[sl]myprogram\.1 man\[sl]myprogram\.1\.md
|
34
|
+
.EE
|
35
|
+
.RE
|
36
|
+
.PP
|
37
|
+
Preview the rendered man page:
|
38
|
+
.PP
|
39
|
+
.RS 4
|
40
|
+
.EX
|
41
|
+
\[Do] kramdown\-man man\[sl]myprogram\.1\.md
|
42
|
+
.EE
|
43
|
+
.RE
|
44
|
+
.SS RUBY
|
45
|
+
.PP
|
46
|
+
.RS 4
|
47
|
+
.EX
|
15
48
|
require \(aqkramdown\(aq
|
16
49
|
require \(aqkramdown\[sl]man\(aq
|
17
50
|
|
18
51
|
doc \[eq] Kramdown::Document\.new(File\.read(\(aqman\[sl]kramdown\-man\.1\.md\(aq))
|
19
52
|
File\.write(\(aqman\[sl]kramdown\-man\.1\(aq,doc\.to\[ru]man)
|
20
53
|
system \(aqman\(aq, \(aqman\[sl]kramdown\-man\.1\(aq
|
21
|
-
.
|
22
|
-
.
|
54
|
+
.EE
|
55
|
+
.RE
|
56
|
+
.SS RAKE TASK
|
57
|
+
.PP
|
58
|
+
Define a \fBman\fR and files tasks which render all \fB*.md\fR files within the
|
59
|
+
\fBman/\fR directory:
|
60
|
+
.PP
|
61
|
+
.RS 4
|
62
|
+
.EX
|
63
|
+
require \(aqkramdown\[sl]man\[sl]task\(aq
|
64
|
+
Kramdown::Man::Task\.new
|
65
|
+
.EE
|
66
|
+
.RE
|
23
67
|
.SH SYNTAX
|
24
|
-
.
|
25
|
-
.
|
26
|
-
.
|
27
|
-
.
|
68
|
+
.SS Code
|
69
|
+
.PP
|
70
|
+
.RS 4
|
71
|
+
.EX
|
28
72
|
\`code\`
|
29
|
-
.
|
30
|
-
.
|
73
|
+
.EE
|
74
|
+
.RE
|
31
75
|
.PP
|
32
76
|
\fBcode\fR
|
33
|
-
.
|
34
|
-
.
|
77
|
+
.SS Emphasis
|
78
|
+
.PP
|
79
|
+
.RS 4
|
80
|
+
.EX
|
35
81
|
*emphasis*
|
36
|
-
.
|
37
|
-
.
|
82
|
+
.EE
|
83
|
+
.RE
|
38
84
|
.PP
|
39
85
|
\fIemphasis\fP
|
40
|
-
.
|
41
|
-
.
|
86
|
+
.SS Strong
|
87
|
+
.PP
|
88
|
+
.RS 4
|
89
|
+
.EX
|
42
90
|
**strong**
|
43
|
-
.
|
44
|
-
.
|
91
|
+
.EE
|
92
|
+
.RE
|
45
93
|
.PP
|
46
94
|
\fBstrong\fP
|
47
|
-
.
|
48
|
-
.
|
49
|
-
.
|
50
|
-
.
|
95
|
+
.SS Paragraph
|
96
|
+
.PP
|
97
|
+
.RS 4
|
98
|
+
.EX
|
51
99
|
Normal paragraph\.
|
52
|
-
.
|
53
|
-
.
|
100
|
+
.EE
|
101
|
+
.RE
|
54
102
|
.PP
|
55
103
|
Normal paragraph\.
|
56
|
-
.
|
57
|
-
.
|
58
|
-
|
59
|
-
.
|
60
|
-
|
61
|
-
.
|
62
|
-
|
63
|
-
.
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
.
|
68
|
-
.
|
104
|
+
.SS Usage String
|
105
|
+
.PP
|
106
|
+
.RS 4
|
107
|
+
.EX
|
108
|
+
\`command\` \[lB]\`\-\-foo\`\[rB] **FILE**
|
109
|
+
.EE
|
110
|
+
.RE
|
111
|
+
.PP
|
112
|
+
\fBcommand\fR \[lB]\fB--foo\fR\[rB] \fBFILE\fP
|
113
|
+
.SS Argument Definitions
|
114
|
+
.PP
|
115
|
+
.RS 4
|
116
|
+
.EX
|
117
|
+
*ARG*
|
118
|
+
: Description here\.
|
119
|
+
.EE
|
120
|
+
.RE
|
69
121
|
.TP
|
70
|
-
\
|
71
|
-
|
72
|
-
.
|
73
|
-
.
|
74
|
-
.
|
75
|
-
.
|
122
|
+
\fIARG\fP
|
123
|
+
Description here\.
|
124
|
+
.SS Option Definitions
|
125
|
+
.PP
|
126
|
+
.RS 4
|
127
|
+
.EX
|
128
|
+
\`\-o\`, \`\-\-option\` *VALUE*
|
129
|
+
: Description here\.
|
130
|
+
.EE
|
131
|
+
.RE
|
132
|
+
.TP
|
133
|
+
\fB-o\fR, \fB--option\fR \fIVALUE\fP
|
134
|
+
Description here\.
|
135
|
+
.SS Links
|
136
|
+
.PP
|
137
|
+
.RS 4
|
138
|
+
.EX
|
76
139
|
\[lB]website\[rB](http:\[sl]\[sl]example\.com\[sl])
|
77
|
-
.
|
78
|
-
.
|
140
|
+
.EE
|
141
|
+
.RE
|
79
142
|
.PP
|
80
143
|
website
|
81
144
|
.UR http:\[sl]\[sl]example\.com\[sl]
|
82
145
|
.UE
|
83
|
-
.
|
84
|
-
.
|
146
|
+
.SS Man Pages
|
147
|
+
.PP
|
148
|
+
Link to other man pages in a project:
|
149
|
+
.PP
|
150
|
+
.RS 4
|
151
|
+
.EX
|
152
|
+
\[lB]kramdown\-man\[rB](kramdown\-man\.1\.md)
|
153
|
+
.EE
|
154
|
+
.RE
|
155
|
+
.PP
|
156
|
+
.BR kramdown\-man (1)
|
157
|
+
.PP
|
158
|
+
Link to other system man page:
|
159
|
+
.PP
|
160
|
+
.RS 4
|
161
|
+
.EX
|
85
162
|
\[lB]bash\[rB](man:bash(1))
|
86
|
-
.
|
87
|
-
.
|
163
|
+
.EE
|
164
|
+
.RE
|
88
165
|
.PP
|
89
166
|
.BR bash (1)
|
90
|
-
.
|
91
|
-
|
167
|
+
.PP
|
168
|
+
\fBNote:\fP only works on firefox
|
169
|
+
.UR https:\[sl]\[sl]www\.mozilla\.org\[sl]en\-US\[sl]firefox\[sl]new\[sl]
|
170
|
+
.UE
|
171
|
+
on Linux\.
|
172
|
+
.SS Email Addresses
|
173
|
+
.PP
|
174
|
+
.RS 4
|
175
|
+
.EX
|
92
176
|
Email <bob\[at]example\.com>
|
93
|
-
.
|
94
|
-
.
|
177
|
+
.EE
|
178
|
+
.RE
|
95
179
|
.PP
|
96
180
|
Email
|
97
181
|
.MT bob\[at]example\.com
|
98
182
|
.ME
|
99
|
-
.
|
100
|
-
.
|
101
|
-
.
|
102
|
-
.
|
183
|
+
.SS Lists
|
184
|
+
.PP
|
185
|
+
.RS 4
|
186
|
+
.EX
|
103
187
|
* one
|
104
188
|
* two
|
105
189
|
* three
|
106
|
-
|
107
|
-
|
108
|
-
.fi
|
109
|
-
.LP
|
190
|
+
.EE
|
191
|
+
.RE
|
110
192
|
.RS
|
111
193
|
.IP \(bu 2
|
112
194
|
one
|
@@ -114,10 +196,16 @@ one
|
|
114
196
|
two
|
115
197
|
.IP \(bu 2
|
116
198
|
three
|
117
|
-
.IP \( 2
|
118
|
-
extra paragraph
|
119
199
|
.RE
|
120
|
-
.
|
200
|
+
.SS Numbered Lists
|
201
|
+
.PP
|
202
|
+
.RS 4
|
203
|
+
.EX
|
204
|
+
1\. one
|
205
|
+
2\. two
|
206
|
+
3\. three
|
207
|
+
.EE
|
208
|
+
.RE
|
121
209
|
.nr step1 0 1
|
122
210
|
.RS
|
123
211
|
.IP \n+[step1]
|
@@ -126,45 +214,61 @@ one
|
|
126
214
|
two
|
127
215
|
.IP \n+[step1]
|
128
216
|
three
|
129
|
-
.
|
130
|
-
|
131
|
-
.
|
132
|
-
.
|
133
|
-
.
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
.
|
140
|
-
|
141
|
-
.
|
142
|
-
|
143
|
-
|
144
|
-
.
|
217
|
+
.RE
|
218
|
+
.SS Definition Lists
|
219
|
+
.PP
|
220
|
+
.RS 4
|
221
|
+
.EX
|
222
|
+
ex\[pc]am\[pc]ple
|
223
|
+
: a thing characteristic of its kind or illustrating a general rule\.
|
224
|
+
|
225
|
+
: a person or thing regarded in terms of their fitness to be imitated or the
|
226
|
+
likelihood of their being imitated\.
|
227
|
+
.EE
|
228
|
+
.RE
|
229
|
+
.TP
|
230
|
+
ex\[pc]am\[pc]ple
|
231
|
+
a thing characteristic of its kind or illustrating a general rule\.
|
232
|
+
.RS
|
233
|
+
.PP
|
234
|
+
a person or thing regarded in terms of their fitness to be imitated or the
|
235
|
+
likelihood of their being imitated\.
|
236
|
+
.RE
|
237
|
+
.SS Blockquotes
|
238
|
+
.PP
|
239
|
+
.RS 4
|
240
|
+
.EX
|
145
241
|
> Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away\.
|
146
242
|
>
|
147
243
|
> \-\-Antoine de Saint\-Exup\['e]ry
|
148
|
-
.
|
149
|
-
.
|
150
|
-
.PP
|
244
|
+
.EE
|
245
|
+
.RE
|
151
246
|
.RS
|
247
|
+
.PP
|
152
248
|
Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away\.
|
153
|
-
.
|
249
|
+
.PP
|
154
250
|
\-\-Antoine de Saint\-Exup\['e]ry
|
155
251
|
.RE
|
156
|
-
.
|
157
|
-
.
|
158
|
-
.
|
159
|
-
.
|
252
|
+
.SS Code Blocks
|
253
|
+
.PP
|
254
|
+
.RS 4
|
255
|
+
.EX
|
256
|
+
Source code:
|
257
|
+
|
160
258
|
\[sh]include <stdio\.h>
|
161
259
|
|
162
260
|
int main()
|
163
261
|
\[lC]
|
164
|
-
|
165
|
-
|
262
|
+
printf(\[dq]hello world\en\[dq]);
|
263
|
+
return 0;
|
166
264
|
\[rC]
|
167
|
-
|
265
|
+
.EE
|
266
|
+
.RE
|
267
|
+
.PP
|
268
|
+
Source code:
|
269
|
+
.PP
|
270
|
+
.RS 4
|
271
|
+
.EX
|
168
272
|
\[sh]include <stdio\.h>
|
169
273
|
|
170
274
|
int main()
|
@@ -172,12 +276,10 @@ int main()
|
|
172
276
|
printf(\[dq]hello world\en\[dq]);
|
173
277
|
return 0;
|
174
278
|
\[rC]
|
175
|
-
.
|
176
|
-
.
|
279
|
+
.EE
|
280
|
+
.RE
|
177
281
|
.SH AUTHOR
|
178
|
-
.LP
|
179
282
|
.PP
|
180
283
|
Postmodern
|
181
284
|
.MT postmodern\.mod3\[at]gmail\.com
|
182
285
|
.ME
|
183
|
-
.LP
|
data/man/kramdown-man.1.md
CHANGED
@@ -1,11 +1,41 @@
|
|
1
|
-
# kramdown-man
|
1
|
+
# kramdown-man 1 "April 2013" kramdown-man "User Manuals"
|
2
|
+
|
3
|
+
## SYNOPSIS
|
4
|
+
|
5
|
+
`kramdown-man` [*options*] *MARKDOWN_FILE*
|
2
6
|
|
3
7
|
## DESCRIPTION
|
4
8
|
|
5
9
|
A [Kramdown][kramdown] plugin for converting Markdown files into man pages.
|
6
10
|
|
11
|
+
## ARGUMENTS
|
12
|
+
|
13
|
+
*MARKDOWN_FILE*
|
14
|
+
: The input markdown file to convert.
|
15
|
+
|
16
|
+
## OPTIONS
|
17
|
+
|
18
|
+
`-o`, `--output` *OUTPUT*
|
19
|
+
: The file to write the man page output to.
|
20
|
+
|
21
|
+
`-V`, `--version`
|
22
|
+
: Prints the `kramdown-man` version.
|
23
|
+
|
24
|
+
`-h`, `--help`
|
25
|
+
: Prints the usage for `kramdown-man`.
|
26
|
+
|
7
27
|
## EXAMPLE
|
8
28
|
|
29
|
+
Render a man page from markdown:
|
30
|
+
|
31
|
+
$ kramdown-man -o man/myprogram.1 man/myprogram.1.md
|
32
|
+
|
33
|
+
Preview the rendered man page:
|
34
|
+
|
35
|
+
$ kramdown-man man/myprogram.1.md
|
36
|
+
|
37
|
+
### RUBY
|
38
|
+
|
9
39
|
require 'kramdown'
|
10
40
|
require 'kramdown/man'
|
11
41
|
|
@@ -13,86 +43,127 @@ A [Kramdown][kramdown] plugin for converting Markdown files into man pages.
|
|
13
43
|
File.write('man/kramdown-man.1',doc.to_man)
|
14
44
|
system 'man', 'man/kramdown-man.1'
|
15
45
|
|
46
|
+
### RAKE TASK
|
47
|
+
|
48
|
+
Define a `man` and files tasks which render all `*.md` files within the
|
49
|
+
`man/` directory:
|
50
|
+
|
51
|
+
require 'kramdown/man/task'
|
52
|
+
Kramdown::Man::Task.new
|
53
|
+
|
16
54
|
## SYNTAX
|
17
55
|
|
18
|
-
###
|
56
|
+
### Code
|
19
57
|
|
20
58
|
`code`
|
21
59
|
|
22
60
|
`code`
|
23
61
|
|
62
|
+
### Emphasis
|
63
|
+
|
24
64
|
*emphasis*
|
25
65
|
|
26
66
|
*emphasis*
|
27
67
|
|
68
|
+
### Strong
|
69
|
+
|
28
70
|
**strong**
|
29
71
|
|
30
72
|
**strong**
|
31
73
|
|
32
|
-
###
|
74
|
+
### Paragraph
|
33
75
|
|
34
76
|
Normal paragraph.
|
35
77
|
|
36
78
|
Normal paragraph.
|
37
79
|
|
38
|
-
|
80
|
+
#### Usage String
|
39
81
|
|
40
|
-
`command` [`--foo`]
|
82
|
+
`command` [`--foo`] **FILE**
|
41
83
|
|
42
|
-
|
43
|
-
Text here.
|
84
|
+
`command` [`--foo`] **FILE**
|
44
85
|
|
45
|
-
|
46
|
-
Text here.
|
86
|
+
#### Argument Definitions
|
47
87
|
|
48
|
-
|
88
|
+
*ARG*
|
89
|
+
: Description here.
|
90
|
+
|
91
|
+
*ARG*
|
92
|
+
: Description here.
|
93
|
+
|
94
|
+
#### Option Definitions
|
95
|
+
|
96
|
+
`-o`, `--option` *VALUE*
|
97
|
+
: Description here.
|
98
|
+
|
99
|
+
`-o`, `--option` *VALUE*
|
100
|
+
: Description here.
|
101
|
+
|
102
|
+
### Links
|
49
103
|
|
50
104
|
[website](http://example.com/)
|
51
105
|
|
52
106
|
[website](http://example.com/)
|
53
107
|
|
108
|
+
#### Man Pages
|
109
|
+
|
110
|
+
Link to other man pages in a project:
|
111
|
+
|
112
|
+
[kramdown-man](kramdown-man.1.md)
|
113
|
+
|
114
|
+
[kramdown-man](kramdown-man.1.md)
|
115
|
+
|
116
|
+
Link to other system man page:
|
117
|
+
|
54
118
|
[bash](man:bash(1))
|
55
119
|
|
56
120
|
[bash](man:bash(1))
|
57
121
|
|
122
|
+
**Note:** only works on [firefox] on Linux.
|
123
|
+
|
124
|
+
[firefox]: https://www.mozilla.org/en-US/firefox/new/
|
125
|
+
|
126
|
+
#### Email Addresses
|
127
|
+
|
58
128
|
Email <bob@example.com>
|
59
129
|
|
60
130
|
Email <bob@example.com>
|
61
131
|
|
62
|
-
###
|
132
|
+
### Lists
|
63
133
|
|
64
134
|
* one
|
65
135
|
* two
|
66
136
|
* three
|
67
|
-
|
68
|
-
extra paragraph
|
69
|
-
|
70
137
|
|
71
138
|
* one
|
72
139
|
* two
|
73
140
|
* three
|
74
141
|
|
75
|
-
|
142
|
+
#### Numbered Lists
|
76
143
|
|
77
144
|
1. one
|
78
145
|
2. two
|
79
146
|
3. three
|
80
|
-
|
81
|
-
extra paragraph
|
82
|
-
|
147
|
+
|
83
148
|
1. one
|
84
149
|
2. two
|
85
150
|
3. three
|
86
151
|
|
87
|
-
|
152
|
+
#### Definition Lists
|
88
153
|
|
89
|
-
|
154
|
+
ex·am·ple
|
155
|
+
: a thing characteristic of its kind or illustrating a general rule.
|
90
156
|
|
91
|
-
|
157
|
+
: a person or thing regarded in terms of their fitness to be imitated or the
|
158
|
+
likelihood of their being imitated.
|
92
159
|
|
93
|
-
|
160
|
+
ex·am·ple
|
161
|
+
: a thing characteristic of its kind or illustrating a general rule.
|
94
162
|
|
95
|
-
|
163
|
+
: a person or thing regarded in terms of their fitness to be imitated or the
|
164
|
+
likelihood of their being imitated.
|
165
|
+
|
166
|
+
### Blockquotes
|
96
167
|
|
97
168
|
> Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.
|
98
169
|
>
|
@@ -102,16 +173,20 @@ Email <bob@example.com>
|
|
102
173
|
>
|
103
174
|
> --Antoine de Saint-Exupéry
|
104
175
|
|
105
|
-
###
|
176
|
+
### Code Blocks
|
177
|
+
|
178
|
+
Source code:
|
106
179
|
|
107
180
|
#include <stdio.h>
|
108
|
-
|
181
|
+
|
109
182
|
int main()
|
110
183
|
{
|
111
|
-
|
112
|
-
|
184
|
+
printf("hello world\n");
|
185
|
+
return 0;
|
113
186
|
}
|
114
187
|
|
188
|
+
Source code:
|
189
|
+
|
115
190
|
#include <stdio.h>
|
116
191
|
|
117
192
|
int main()
|