Skip to content

Commit

Permalink
Merge pull request #7859 from ckeditor/i/7850
Browse files Browse the repository at this point in the history
Other (markdown-gfm): Upgraded to Marked v1.1.1. Closes #7850.
  • Loading branch information
jodator authored Aug 18, 2020
2 parents 3d896ee + 5401c73 commit d6c8731
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 33 deletions.
2 changes: 1 addition & 1 deletion packages/ckeditor5-markdown-gfm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@ckeditor/ckeditor5-engine": "^21.0.0",
"@ckeditor/ckeditor5-list": "^21.0.0",
"@ckeditor/ckeditor5-table": "^21.0.0",
"marked": "^0.7.0",
"marked": "^1.1.1",
"turndown": "^6.0.0",
"turndown-plugin-gfm": "^1.0.2"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@

import marked from 'marked';

// Overrides.
marked.use( {
tokenizer: {
// Disable the autolink rule in the lexer.
autolink: () => null,
url: () => null
}
} );

/**
* Parses markdown string to an HTML.
*
Expand All @@ -26,7 +35,3 @@ export default function markdown2html( markdown ) {
}

export { marked };

// Disable the autolink rule in the lexer (point it to a regex that always fail).
marked.InlineLexer.rules.breaks.autolink = /^\b$/;
marked.InlineLexer.rules.breaks.url = /^\b$/;
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,23 @@ describe( 'GFMDataProcessor', () => {
'<code>' +
'code 2' +
'</code>' +
'</pre>' +
'</blockquote>'
// Space after `</pre>` might be due to bug in engine. See: https://github.com/ckeditor/ckeditor5/issues/7863.
'</pre> ' +
'</blockquote>',

'> Example 1:\n' +
'>\n' +
'> ```\n' +
'> code 1\n' +
'> ```\n' +
'>\n' +
'> Example 2:\n' +
'>\n' +
'> ```\n' +
'> code 2\n' +
'> ```' +
// The below is an artefact of space after `</pre>`. See comment above & https://github.com/ckeditor/ckeditor5/issues/7863.
'\n>\n>'
);
} );

Expand Down Expand Up @@ -154,7 +169,8 @@ describe( 'GFMDataProcessor', () => {
'<code>' +
'code 2' +
'</code>' +
'</pre>' +
// Space after `</pre>` might be due to bug in engine. See: https://github.com/ckeditor/ckeditor5/issues/7863.
'</pre> ' +
'</blockquote>',

// When converting back to data, DataProcessor will normalize tabs to ```.
Expand All @@ -168,7 +184,9 @@ describe( 'GFMDataProcessor', () => {
'>\n' +
'> ```\n' +
'> code 2\n' +
'> ```'
'> ```' +
// The below is an artefact of space after `</pre>`. See comment above & https://github.com/ckeditor/ckeditor5/issues/7863.
'\n>\n>'
);
} );
} );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ describe( 'GFMDataProcessor', () => {
testDataProcessor(
'regular text and` inline code`',

'<p>regular text and<code>inline code</code></p>',
'<p>regular text and<code> inline code</code></p>',

// When converting back it will be normalized and spaces
// at the beginning of inline code will be removed.
'regular text and`inline code`'
'regular text and `inline code`'
);
} );

Expand Down
53 changes: 31 additions & 22 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1414,9 +1414,9 @@
integrity sha1-aaI6OtKcrwCX8G7aWbNh7i8GOfY=

"@types/node@*", "@types/node@>= 8", "@types/node@^14.0.18":
version "14.0.27"
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.0.27.tgz#a151873af5a5e851b51b3b065c9e63390a9e0eb1"
integrity sha512-kVrqXhbclHNHGu9ztnAwSncIgJv/FaxmzXJvGXNdcCpV1b8u1/Mi6z6m0vwy0LzKeXFTPLH0NzwmoJ3fNCIq0g==
version "14.6.0"
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.6.0.tgz#7d4411bf5157339337d7cff864d9ff45f177b499"
integrity sha512-mikldZQitV94akrc4sCcSjtJfsTKt4p+e/s0AGscVA6XArQ9kFclP+ZiYUMnq987rc6QlYxXv/EivqlfSLxpKA==

"@types/node@^13.7.0":
version "13.13.15"
Expand Down Expand Up @@ -2736,9 +2736,9 @@ caniuse-api@^3.0.0:
lodash.uniq "^4.5.0"

caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001111:
version "1.0.30001114"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001114.tgz#2e88119afb332ead5eaa330e332e951b1c4bfea9"
integrity sha512-ml/zTsfNBM+T1+mjglWRPgVsu2L76GAaADKX5f4t0pbhttEp0WMawJsHDYlFkVZkoA+89uvBRrVrEE4oqenzXQ==
version "1.0.30001115"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001115.tgz#c04cd828883ba47f6f776312e0817bcc9040cfa4"
integrity sha512-NZrG0439ePYna44lJX8evHX2L7Z3/z3qjVLnHgbBb/duNEnGo348u+BQS5o4HTWcrb++100dHFrU36IesIrC1Q==

caseless@~0.12.0:
version "0.12.0"
Expand Down Expand Up @@ -4041,14 +4041,23 @@ dom-serialize@^2.2.1:
extend "^3.0.0"
void-elements "^2.0.0"

dom-serializer@0, dom-serializer@^0.2.1:
dom-serializer@0:
version "0.2.2"
resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-0.2.2.tgz#1afb81f533717175d478655debc5e332d9f9bb51"
integrity sha512-2/xPb3ORsQ42nHYiSunXkDjPLBaEj/xTwUO4B7XCZQTRk7EBtTOPaygh10YAAh2OI1Qrp6NWfpAhzswj0ydt9g==
dependencies:
domelementtype "^2.0.1"
entities "^2.0.0"

dom-serializer@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-1.0.1.tgz#79695eb49af3cd8abc8d93a73da382deb1ca0795"
integrity sha512-1Aj1Qy3YLbdslkI75QEOfdp9TkQ3o8LRISAzxOibjBs/xWwr1WxZFOQphFkZuepHFGo+kB8e5FVJSS0faAJ4Rw==
dependencies:
domelementtype "^2.0.1"
domhandler "^3.0.0"
entities "^2.0.0"

dom-serializer@~0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-0.1.1.tgz#1ec4059e284babed36eec2941d4a970a189ce7c0"
Expand Down Expand Up @@ -4110,11 +4119,11 @@ domutils@^1.5.1, domutils@^1.7.0, domutils@~1.7.0:
domelementtype "1"

domutils@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/domutils/-/domutils-2.1.0.tgz#7ade3201af43703fde154952e3a868eb4b635f16"
integrity sha512-CD9M0Dm1iaHfQ1R/TI+z3/JWp/pgub0j4jIQKH89ARR4ATAV2nbaOQS5XxU9maJP5jHaPdDDQSEHuE2UmpUTKg==
version "2.2.0"
resolved "https://registry.yarnpkg.com/domutils/-/domutils-2.2.0.tgz#f3ce1610af5c30280bde1b71f84b018b958f32cf"
integrity sha512-0haAxVr1PR0SqYwCH7mxMpHZUwjih9oPPedqpR/KufsnxPyZ9dyVw1R5093qnJF3WXSbjBkdzRWLw/knJV/fAg==
dependencies:
dom-serializer "^0.2.1"
dom-serializer "^1.0.1"
domelementtype "^2.0.1"
domhandler "^3.0.0"

Expand Down Expand Up @@ -4181,9 +4190,9 @@ [email protected]:
integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=

electron-to-chromium@^1.3.523:
version "1.3.533"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.533.tgz#d7e5ca4d57e9bc99af87efbe13e7be5dde729b0f"
integrity sha512-YqAL+NXOzjBnpY+dcOKDlZybJDCOzgsq4koW3fvyty/ldTmsb4QazZpOWmVvZ2m0t5jbBf7L0lIGU3BUipwG+A==
version "1.3.534"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.534.tgz#fc7af8518dd00a5b22a24aed3f116b5d097e2330"
integrity sha512-7x2S3yUrspNHQOoPk+Eo+iHViSiJiEGPI6BpmLy1eT2KRNGCkBt/NUYqjfXLd1DpDCQp7n3+LfA1RkbG+LqTZQ==

elliptic@^6.5.3:
version "6.5.3"
Expand Down Expand Up @@ -7475,16 +7484,16 @@ markdown@~0.5.0:
dependencies:
nopt "~2.1.1"

marked@^0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/marked/-/marked-0.7.0.tgz#b64201f051d271b1edc10a04d1ae9b74bb8e5c0e"
integrity sha512-c+yYdCZJQrsRjTPhUx7VKkApw9bwDkNbHUKo1ovgcfDjb2kc8rLuRbIFyXL5WOEUwzSSKo3IXpph2K6DqB/KZg==

marked@^0.8.2:
version "0.8.2"
resolved "https://registry.yarnpkg.com/marked/-/marked-0.8.2.tgz#4faad28d26ede351a7a1aaa5fec67915c869e355"
integrity sha512-EGwzEeCcLniFX51DhTpmTom+dSA/MG/OBUDjnWtHbEnjAH180VzUeAw+oE4+Zv+CoYBWyRlYOTR0N8SO9R1PVw==

marked@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/marked/-/marked-1.1.1.tgz#e5d61b69842210d5df57b05856e0c91572703e6a"
integrity sha512-mJzT8D2yPxoPh7h0UXkB+dBj4FykPJ2OIfxAWeIHrvoHDkFxukV/29QxoFQoPM6RLEwhIFdJpmKBlqVM3s2ZIw==

marked@~0.3.6:
version "0.3.19"
resolved "https://registry.yarnpkg.com/marked/-/marked-0.3.19.tgz#5d47f709c4c9fc3c216b6d46127280f40b39d790"
Expand Down Expand Up @@ -9638,9 +9647,9 @@ [email protected]:
integrity sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=

querystringify@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.1.1.tgz#60e5a5fd64a7f8bfa4d2ab2ed6fdf4c85bad154e"
integrity sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA==
version "2.2.0"
resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6"
integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==

quick-lru@^4.0.1:
version "4.0.1"
Expand Down

0 comments on commit d6c8731

Please sign in to comment.