4
4
5
5
# markdown-js
6
6
7
- Yet another markdown parser, this time for JavaScript. There's a few
8
- options that precede this project but they all treat markdown to HTML
9
- conversion as a single step process. You pass markdown in and get HTML
7
+ Yet another Markdown parser, this time for JavaScript. There's a few
8
+ options that precede this project but they all treat Markdown to HTML
9
+ conversion as a single step process. You pass Markdown in and get HTML
10
10
out, end of story. We had some pretty particular views on how the
11
11
process should actually look, which include:
12
12
13
- * producing well-formed HTML. This means that ` em ` and ` strong ` nesting
13
+ * Producing well-formed HTML. This means that ` em ` and ` strong ` nesting
14
14
is important, as is the ability to output as both HTML and XHTML
15
- * having an intermediate representation to allow processing of parsed
15
+ * Having an intermediate representation to allow processing of parsed
16
16
data (we in fact have two, both [ JsonML] : a markdown tree and an HTML tree)
17
- * being easily extensible to add new dialects without having to
17
+ * Being easily extensible to add new dialects without having to
18
18
rewrite the entire parsing mechanics
19
- * having a good test suite. The only test suites we could find tested
19
+ * Having a good test suite. The only test suites we could find tested
20
20
massive blocks of input, and passing depended on outputting the HTML
21
21
with exactly the same whitespace as the original implementation
22
22
@@ -43,7 +43,7 @@ download the version you want (minified or not).
43
43
44
44
### Node
45
45
46
- The simple way to use it with node is:
46
+ The simple way to use it with Node is:
47
47
48
48
``` js
49
49
var markdown = require ( " markdown" ).markdown ;
@@ -77,10 +77,10 @@ It also works in a browser; here is a complete example:
77
77
</html >
78
78
```
79
79
80
- ### Command line
80
+ ### Command Line
81
81
82
82
Assuming you've installed the ` md2html ` script (see Installation,
83
- above), you can convert markdown to html :
83
+ above), you can convert Markdown to HTML :
84
84
85
85
``` bash
86
86
# read from a file
@@ -90,7 +90,7 @@ md2html /path/to/doc.md > /path/to/doc.html
90
90
echo ' Hello *World*!' | md2html
91
91
```
92
92
93
- ### More options
93
+ ### More Options
94
94
95
95
If you want more control check out the documentation in
96
96
[ the .js files under src/] [ src_folder ] which details all the methods and parameters
@@ -139,13 +139,13 @@ console.log( html );
139
139
140
140
## Intermediate Representation
141
141
142
- Internally the process to convert a chunk of markdown into a chunk of
142
+ Internally the process to convert a chunk of Markdown into a chunk of
143
143
HTML has three steps:
144
144
145
- 1 . Parse the markdown into a JsonML tree. Any references found in the
145
+ 1 . Parse the Markdown into a JsonML tree. Any references found in the
146
146
parsing are stored in the attribute hash of the root node under the
147
147
key ` references ` .
148
- 2 . Convert the markdown tree into an HTML tree. Rename any nodes that
148
+ 2 . Convert the Markdown tree into an HTML tree. Rename any nodes that
149
149
need it (` bulletlist ` to ` ul ` for example) and lookup any references
150
150
used by links or images. Remove the references attribute once done.
151
151
3 . Stringify the HTML tree being careful not to wreck whitespace where
@@ -183,16 +183,16 @@ syntax if you don't want to include Maruku support.
183
183
[ Gruber ] : http://daringfireball.net/projects/markdown/syntax
184
184
[ Maruku ] : http://maruku.rubyforge.org/maruku.html
185
185
186
- ## Running tests
186
+ ## Running Tests
187
187
188
- To run the tests under node you will need tap installed (it's listed as a
188
+ To run the tests under Node you will need tap installed (it's listed as a
189
189
` devDependencies ` so ` npm install ` from the checkout should be enough), then do
190
190
191
191
$ npm test
192
192
193
193
## Contributing
194
194
195
- Do the usual github fork and pull request dance. Add yourself to the
195
+ Do the usual GitHub fork and pull request dance. Add yourself to the
196
196
contributors section of [ package.json] too if you want to.
197
197
198
198
[ package.json ] : https://github.com/evilstreak/markdown-js/blob/master/package.json
0 commit comments