@ascua/marked.js 0.9.0 → 0.10.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.
@@ -8,11 +8,11 @@ export default function(value, inline) {
8
8
  switch (inline) {
9
9
  case true:
10
10
  return marked.parseInline(String(value), {
11
- gfm: true, breaks: true, renderer: renderer,
11
+ async: false, gfm: true, breaks: true, renderer: renderer,
12
12
  });
13
13
  case false:
14
14
  return marked.parse(String(value), {
15
- gfm: true, breaks: true,
15
+ async: false, gfm: true, breaks: true,
16
16
  });
17
17
  }
18
18
 
@@ -1,21 +1,37 @@
1
1
  import marked from 'marked';
2
2
 
3
3
  const renderer = new marked.Renderer();
4
- renderer.heading = (text) => text + '\n';
5
- renderer.image = () => '';
6
- renderer.link = (href, title, text) => text + ` (${href})`;
7
- renderer.paragraph = (text) => text + '\n';
4
+ // Ignore all code blocks
8
5
  renderer.code = () => '';
9
- renderer.html = (html) => html;
10
- renderer.strong = (text) => text;
11
- renderer.em = (text) => text;
12
- renderer.codespan = (text) => text;
6
+ // Ignore all images
7
+ renderer.image = () => '';
8
+ // Convert breaks to new lines
13
9
  renderer.br = () => '\n';
10
+ // Convert html to plain text
11
+ renderer.html = (token) => token.text;
12
+ // Convert codespans to plain text
13
+ renderer.codespan = (token) => token.text;
14
+ // Convert all other types recursively
15
+ renderer.heading = function(token) {
16
+ return this.parser.parseInline(token.tokens) + '\n';
17
+ };
18
+ renderer.link = function(token) {
19
+ return this.parser.parseInline(token.tokens) + ` (${token.href})`;
20
+ };
21
+ renderer.paragraph = function(token) {
22
+ return this.parser.parseInline(token.tokens) + '\n';
23
+ };
24
+ renderer.strong = function(token) {
25
+ return this.parser.parseInline(token.tokens);
26
+ };
27
+ renderer.em = function(token) {
28
+ return this.parser.parseInline(token.tokens);
29
+ };
14
30
 
15
31
  export default function(value) {
16
32
 
17
33
  return marked.parse(String(value), {
18
- renderer: renderer,
34
+ async: false, renderer: renderer,
19
35
  }).replace(/&#(\d+);/g, (m, dec) => {
20
36
  return String.fromCharCode(dec);
21
37
  }).replace(/ /g, () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ascua/marked.js",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "Small description for @ascua/marked.js goes here",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -26,5 +26,5 @@
26
26
  "publishConfig": {
27
27
  "access": "public"
28
28
  },
29
- "gitHead": "f1aaebcd2ca75ddd32055dd9f7cf3c0b3110df7d"
29
+ "gitHead": "18d3d333fcdb0b5c919ac42794fdb6d87d415ce8"
30
30
  }