@ckeditor/ckeditor5-markdown-gfm 39.0.1 → 40.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.
@@ -1,44 +1,44 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @module markdown-gfm/markdown2html/markdown2html
7
- */
8
- import { marked } from 'marked';
9
- // Overrides.
10
- marked.use({
11
- tokenizer: {
12
- // Disable the autolink rule in the lexer.
13
- autolink: () => null,
14
- url: () => null
15
- },
16
- renderer: {
17
- checkbox(...args) {
18
- // Remove bogus space after <input type="checkbox"> because it would be preserved
19
- // by DomConverter as it's next to an inline object.
20
- return Object.getPrototypeOf(this).checkbox.call(this, ...args).trimRight();
21
- },
22
- code(...args) {
23
- // Since marked v1.2.8, every <code> gets a trailing "\n" whether it originally
24
- // ended with one or not (see https://github.com/markedjs/marked/issues/1884 to learn why).
25
- // This results in a redundant soft break in the model when loaded into the editor, which
26
- // is best prevented at this stage. See https://github.com/ckeditor/ckeditor5/issues/11124.
27
- return Object.getPrototypeOf(this).code.call(this, ...args).replace('\n</code>', '</code>');
28
- }
29
- }
30
- });
31
- /**
32
- * Parses markdown string to an HTML.
33
- */
34
- export default function markdown2html(markdown) {
35
- const options = {
36
- gfm: true,
37
- breaks: true,
38
- tables: true,
39
- xhtml: true,
40
- headerIds: false
41
- };
42
- return marked.parse(markdown, options);
43
- }
44
- export { marked };
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module markdown-gfm/markdown2html/markdown2html
7
+ */
8
+ import { marked } from 'marked';
9
+ // Overrides.
10
+ marked.use({
11
+ tokenizer: {
12
+ // Disable the autolink rule in the lexer.
13
+ autolink: () => null,
14
+ url: () => null
15
+ },
16
+ renderer: {
17
+ checkbox(...args) {
18
+ // Remove bogus space after <input type="checkbox"> because it would be preserved
19
+ // by DomConverter as it's next to an inline object.
20
+ return Object.getPrototypeOf(this).checkbox.call(this, ...args).trimRight();
21
+ },
22
+ code(...args) {
23
+ // Since marked v1.2.8, every <code> gets a trailing "\n" whether it originally
24
+ // ended with one or not (see https://github.com/markedjs/marked/issues/1884 to learn why).
25
+ // This results in a redundant soft break in the model when loaded into the editor, which
26
+ // is best prevented at this stage. See https://github.com/ckeditor/ckeditor5/issues/11124.
27
+ return Object.getPrototypeOf(this).code.call(this, ...args).replace('\n</code>', '</code>');
28
+ }
29
+ }
30
+ });
31
+ /**
32
+ * Parses markdown string to an HTML.
33
+ */
34
+ export default function markdown2html(markdown) {
35
+ const options = {
36
+ gfm: true,
37
+ breaks: true,
38
+ tables: true,
39
+ xhtml: true,
40
+ headerIds: false
41
+ };
42
+ return marked.parse(markdown, options);
43
+ }
44
+ export { marked };