Skip to content

Commit 72410a8

Browse files
authored
Merge pull request #1521 from UziTech/es6-docs
update examples with es6+
2 parents 29ac9ae + e3bb190 commit 72410a8

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

docs/USING_PRO.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Extending Marked
22

3-
To champion the single-responsibility and open/closed prinicples, we have tried to make it relatively painless to extend marked. If you are looking to add custom functionality, this is the place to start.
3+
To champion the single-responsibility and open/closed principles, we have tried to make it relatively painless to extend marked. If you are looking to add custom functionality, this is the place to start.
44

55
<h2 id="renderer">The renderer</h2>
66

@@ -10,14 +10,14 @@ The renderer is...
1010

1111
```js
1212
// Create reference instance
13-
var myMarked = require('marked');
13+
const marked = require('marked');
1414

1515
// Get reference
16-
var renderer = new myMarked.Renderer();
16+
const renderer = new marked.Renderer();
1717

1818
// Override function
1919
renderer.heading = function (text, level) {
20-
var escapedText = text.toLowerCase().replace(/[^\w]+/g, '-');
20+
const escapedText = text.toLowerCase().replace(/[^\w]+/g, '-');
2121

2222
return `
2323
<h${level}>
@@ -29,7 +29,7 @@ renderer.heading = function (text, level) {
2929
};
3030

3131
// Run marked
32-
console.log(myMarked('# heading+', { renderer: renderer }));
32+
console.log(marked('# heading+', { renderer: renderer }));
3333
```
3434

3535
**Output:**
@@ -105,13 +105,13 @@ The parser is...
105105
You also have direct access to the lexer and parser if you so desire.
106106

107107
``` js
108-
var tokens = marked.lexer(text, options);
108+
const tokens = marked.lexer(text, options);
109109
console.log(marked.parser(tokens));
110110
```
111111

112112
``` js
113-
var lexer = new marked.Lexer(options);
114-
var tokens = lexer.lex(text);
113+
const lexer = new marked.Lexer(options);
114+
const tokens = lexer.lex(text);
115115
console.log(tokens);
116116
console.log(lexer.rules);
117117
```

0 commit comments

Comments
 (0)