@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.
- package/CHANGELOG.md +1 -1
- package/LICENSE.md +1 -1
- package/README.md +3 -3
- package/build/markdown-gfm.js.map +1 -0
- package/package.json +2 -6
- package/src/augmentation.d.ts +10 -10
- package/src/augmentation.js +5 -5
- package/src/gfmdataprocessor.d.ts +62 -62
- package/src/gfmdataprocessor.js +72 -72
- package/src/html2markdown/html2markdown.d.ts +10 -10
- package/src/html2markdown/html2markdown.js +126 -126
- package/src/index.d.ts +9 -9
- package/src/index.js +9 -9
- package/src/markdown.d.ts +23 -23
- package/src/markdown.js +29 -29
- package/src/markdown2html/markdown2html.d.ts +13 -13
- package/src/markdown2html/markdown2html.js +44 -44
package/src/gfmdataprocessor.js
CHANGED
@@ -1,72 +1,72 @@
|
|
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/gfmdataprocessor
|
7
|
-
*/
|
8
|
-
import { HtmlDataProcessor } from 'ckeditor5/src/engine';
|
9
|
-
import markdown2html from './markdown2html/markdown2html';
|
10
|
-
import html2markdown, { turndownService } from './html2markdown/html2markdown';
|
11
|
-
/**
|
12
|
-
* This data processor implementation uses GitHub Flavored Markdown as input/output data.
|
13
|
-
*
|
14
|
-
* See the {@glink features/markdown Markdown output} guide to learn more on how to enable it.
|
15
|
-
*/
|
16
|
-
export default class GFMDataProcessor {
|
17
|
-
/**
|
18
|
-
* Creates a new instance of the Markdown data processor class.
|
19
|
-
*/
|
20
|
-
constructor(document) {
|
21
|
-
this._htmlDP = new HtmlDataProcessor(document);
|
22
|
-
}
|
23
|
-
/**
|
24
|
-
* Keeps the specified element in the output as HTML. This is useful if the editor contains
|
25
|
-
* features producing HTML that is not a part of the Markdown standard.
|
26
|
-
*
|
27
|
-
* By default, all HTML tags are removed.
|
28
|
-
*
|
29
|
-
* @param element The element name to be kept.
|
30
|
-
*/
|
31
|
-
keepHtml(element) {
|
32
|
-
turndownService.keep([element]);
|
33
|
-
}
|
34
|
-
/**
|
35
|
-
* Converts the provided Markdown string to a view tree.
|
36
|
-
*
|
37
|
-
* @param data A Markdown string.
|
38
|
-
* @returns The converted view element.
|
39
|
-
*/
|
40
|
-
toView(data) {
|
41
|
-
const html = markdown2html(data);
|
42
|
-
return this._htmlDP.toView(html);
|
43
|
-
}
|
44
|
-
/**
|
45
|
-
* Converts the provided {@link module:engine/view/documentfragment~DocumentFragment} to data format — in this
|
46
|
-
* case to a Markdown string.
|
47
|
-
*
|
48
|
-
* @returns Markdown string.
|
49
|
-
*/
|
50
|
-
toData(viewFragment) {
|
51
|
-
const html = this._htmlDP.toData(viewFragment);
|
52
|
-
return html2markdown(html);
|
53
|
-
}
|
54
|
-
/**
|
55
|
-
* Registers a {@link module:engine/view/matcher~MatcherPattern} for view elements whose content should be treated as raw data
|
56
|
-
* and not processed during the conversion from Markdown to view elements.
|
57
|
-
*
|
58
|
-
* The raw data can be later accessed by a
|
59
|
-
* {@link module:engine/view/element~Element#getCustomProperty custom property of a view element} called `"$rawContent"`.
|
60
|
-
*
|
61
|
-
* @param pattern The pattern matching all view elements whose content should
|
62
|
-
* be treated as raw data.
|
63
|
-
*/
|
64
|
-
registerRawContentMatcher(pattern) {
|
65
|
-
this._htmlDP.registerRawContentMatcher(pattern);
|
66
|
-
}
|
67
|
-
/**
|
68
|
-
* This method does not have any effect on the data processor result. It exists for compatibility with the
|
69
|
-
* {@link module:engine/dataprocessor/dataprocessor~DataProcessor `DataProcessor` interface}.
|
70
|
-
*/
|
71
|
-
useFillerType() { }
|
72
|
-
}
|
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/gfmdataprocessor
|
7
|
+
*/
|
8
|
+
import { HtmlDataProcessor } from 'ckeditor5/src/engine';
|
9
|
+
import markdown2html from './markdown2html/markdown2html';
|
10
|
+
import html2markdown, { turndownService } from './html2markdown/html2markdown';
|
11
|
+
/**
|
12
|
+
* This data processor implementation uses GitHub Flavored Markdown as input/output data.
|
13
|
+
*
|
14
|
+
* See the {@glink features/markdown Markdown output} guide to learn more on how to enable it.
|
15
|
+
*/
|
16
|
+
export default class GFMDataProcessor {
|
17
|
+
/**
|
18
|
+
* Creates a new instance of the Markdown data processor class.
|
19
|
+
*/
|
20
|
+
constructor(document) {
|
21
|
+
this._htmlDP = new HtmlDataProcessor(document);
|
22
|
+
}
|
23
|
+
/**
|
24
|
+
* Keeps the specified element in the output as HTML. This is useful if the editor contains
|
25
|
+
* features producing HTML that is not a part of the Markdown standard.
|
26
|
+
*
|
27
|
+
* By default, all HTML tags are removed.
|
28
|
+
*
|
29
|
+
* @param element The element name to be kept.
|
30
|
+
*/
|
31
|
+
keepHtml(element) {
|
32
|
+
turndownService.keep([element]);
|
33
|
+
}
|
34
|
+
/**
|
35
|
+
* Converts the provided Markdown string to a view tree.
|
36
|
+
*
|
37
|
+
* @param data A Markdown string.
|
38
|
+
* @returns The converted view element.
|
39
|
+
*/
|
40
|
+
toView(data) {
|
41
|
+
const html = markdown2html(data);
|
42
|
+
return this._htmlDP.toView(html);
|
43
|
+
}
|
44
|
+
/**
|
45
|
+
* Converts the provided {@link module:engine/view/documentfragment~DocumentFragment} to data format — in this
|
46
|
+
* case to a Markdown string.
|
47
|
+
*
|
48
|
+
* @returns Markdown string.
|
49
|
+
*/
|
50
|
+
toData(viewFragment) {
|
51
|
+
const html = this._htmlDP.toData(viewFragment);
|
52
|
+
return html2markdown(html);
|
53
|
+
}
|
54
|
+
/**
|
55
|
+
* Registers a {@link module:engine/view/matcher~MatcherPattern} for view elements whose content should be treated as raw data
|
56
|
+
* and not processed during the conversion from Markdown to view elements.
|
57
|
+
*
|
58
|
+
* The raw data can be later accessed by a
|
59
|
+
* {@link module:engine/view/element~Element#getCustomProperty custom property of a view element} called `"$rawContent"`.
|
60
|
+
*
|
61
|
+
* @param pattern The pattern matching all view elements whose content should
|
62
|
+
* be treated as raw data.
|
63
|
+
*/
|
64
|
+
registerRawContentMatcher(pattern) {
|
65
|
+
this._htmlDP.registerRawContentMatcher(pattern);
|
66
|
+
}
|
67
|
+
/**
|
68
|
+
* This method does not have any effect on the data processor result. It exists for compatibility with the
|
69
|
+
* {@link module:engine/dataprocessor/dataprocessor~DataProcessor `DataProcessor` interface}.
|
70
|
+
*/
|
71
|
+
useFillerType() { }
|
72
|
+
}
|
@@ -1,10 +1,10 @@
|
|
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
|
-
declare const turndownService: any;
|
6
|
-
/**
|
7
|
-
* Parses HTML to a markdown.
|
8
|
-
*/
|
9
|
-
export default function html2markdown(html: string): string;
|
10
|
-
export { turndownService };
|
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
|
+
declare const turndownService: any;
|
6
|
+
/**
|
7
|
+
* Parses HTML to a markdown.
|
8
|
+
*/
|
9
|
+
export default function html2markdown(html: string): string;
|
10
|
+
export { turndownService };
|
@@ -1,126 +1,126 @@
|
|
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/html2markdown/html2markdown
|
7
|
-
*/
|
8
|
-
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
9
|
-
// Importing types for this package is problematic, so it's omitted.
|
10
|
-
// @ts-ignore
|
11
|
-
import TurndownService from 'turndown';
|
12
|
-
// There no avaialble types for 'turndown-plugin-gfm' module and it's not worth to generate them on our own.
|
13
|
-
// @ts-ignore
|
14
|
-
import { gfm } from 'turndown-plugin-gfm';
|
15
|
-
// Override the original escape method by not escaping links.
|
16
|
-
const originalEscape = TurndownService.prototype.escape;
|
17
|
-
function escape(string) {
|
18
|
-
string = originalEscape(string);
|
19
|
-
// Escape "<".
|
20
|
-
string = string.replace(/</g, '\\<');
|
21
|
-
return string;
|
22
|
-
}
|
23
|
-
TurndownService.prototype.escape = function (string) {
|
24
|
-
// Urls should not be escaped. Our strategy is using a regex to find them and escape everything
|
25
|
-
// which is out of the matches parts.
|
26
|
-
let escaped = '';
|
27
|
-
let lastLinkEnd = 0;
|
28
|
-
for (const match of matchAutolink(string)) {
|
29
|
-
const index = match.index;
|
30
|
-
// Append the substring between the last match and the current one (if anything).
|
31
|
-
if (index > lastLinkEnd) {
|
32
|
-
escaped += escape(string.substring(lastLinkEnd, index));
|
33
|
-
}
|
34
|
-
const matchedURL = match[0];
|
35
|
-
escaped += matchedURL;
|
36
|
-
lastLinkEnd = index + matchedURL.length;
|
37
|
-
}
|
38
|
-
// Add text after the last link or at the string start if no matches.
|
39
|
-
if (lastLinkEnd < string.length) {
|
40
|
-
escaped += escape(string.substring(lastLinkEnd, string.length));
|
41
|
-
}
|
42
|
-
return escaped;
|
43
|
-
};
|
44
|
-
const turndownService = new TurndownService({
|
45
|
-
codeBlockStyle: 'fenced',
|
46
|
-
hr: '---',
|
47
|
-
headingStyle: 'atx'
|
48
|
-
});
|
49
|
-
turndownService.use([
|
50
|
-
gfm,
|
51
|
-
todoList
|
52
|
-
]);
|
53
|
-
/**
|
54
|
-
* Parses HTML to a markdown.
|
55
|
-
*/
|
56
|
-
export default function html2markdown(html) {
|
57
|
-
return turndownService.turndown(html);
|
58
|
-
}
|
59
|
-
export { turndownService };
|
60
|
-
// This is a copy of the original taskListItems rule from turdown-plugin-gfm, with minor changes.
|
61
|
-
function todoList(turndownService) {
|
62
|
-
turndownService.addRule('taskListItems', {
|
63
|
-
filter(node) {
|
64
|
-
return node.type === 'checkbox' &&
|
65
|
-
// Changes here as CKEditor outputs a deeper structure.
|
66
|
-
(node.parentNode.nodeName === 'LI' || node.parentNode.parentNode.nodeName === 'LI');
|
67
|
-
},
|
68
|
-
replacement(content, node) {
|
69
|
-
return (node.checked ? '[x]' : '[ ]') + ' ';
|
70
|
-
}
|
71
|
-
});
|
72
|
-
}
|
73
|
-
// Autolink matcher.
|
74
|
-
const regex = new RegExp(
|
75
|
-
// Prefix.
|
76
|
-
/\b(?:(?:https?|ftp):\/\/|www\.)/.source +
|
77
|
-
// Domain name.
|
78
|
-
/(?![-_])(?:[-_a-z0-9\u00a1-\uffff]{1,63}\.)+(?:[a-z\u00a1-\uffff]{2,63})/.source +
|
79
|
-
// The rest.
|
80
|
-
/(?:[^\s<>]*)/.source, 'gi');
|
81
|
-
/**
|
82
|
-
* Trimming end of link.
|
83
|
-
* https://github.github.com/gfm/#autolinks-extension-
|
84
|
-
*/
|
85
|
-
function* matchAutolink(string) {
|
86
|
-
for (const match of string.matchAll(regex)) {
|
87
|
-
const matched = match[0];
|
88
|
-
const length = autolinkFindEnd(matched);
|
89
|
-
yield Object.assign([matched.substring(0, length)], { index: match.index });
|
90
|
-
// We could adjust regex.lastIndex but it's not needed because what we skipped is for sure not a valid URL.
|
91
|
-
}
|
92
|
-
}
|
93
|
-
/**
|
94
|
-
* Returns the new length of the link (after it would trim trailing characters).
|
95
|
-
*/
|
96
|
-
function autolinkFindEnd(string) {
|
97
|
-
let length = string.length;
|
98
|
-
while (length > 0) {
|
99
|
-
const char = string[length - 1];
|
100
|
-
if ('?!.,:*_~\'"'.includes(char)) {
|
101
|
-
length--;
|
102
|
-
}
|
103
|
-
else if (char == ')') {
|
104
|
-
let openBrackets = 0;
|
105
|
-
for (let i = 0; i < length; i++) {
|
106
|
-
if (string[i] == '(') {
|
107
|
-
openBrackets++;
|
108
|
-
}
|
109
|
-
else if (string[i] == ')') {
|
110
|
-
openBrackets--;
|
111
|
-
}
|
112
|
-
}
|
113
|
-
// If there is fewer opening brackets then closing ones we should remove a closing bracket.
|
114
|
-
if (openBrackets < 0) {
|
115
|
-
length--;
|
116
|
-
}
|
117
|
-
else {
|
118
|
-
break;
|
119
|
-
}
|
120
|
-
}
|
121
|
-
else {
|
122
|
-
break;
|
123
|
-
}
|
124
|
-
}
|
125
|
-
return length;
|
126
|
-
}
|
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/html2markdown/html2markdown
|
7
|
+
*/
|
8
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
9
|
+
// Importing types for this package is problematic, so it's omitted.
|
10
|
+
// @ts-ignore
|
11
|
+
import TurndownService from 'turndown';
|
12
|
+
// There no avaialble types for 'turndown-plugin-gfm' module and it's not worth to generate them on our own.
|
13
|
+
// @ts-ignore
|
14
|
+
import { gfm } from 'turndown-plugin-gfm';
|
15
|
+
// Override the original escape method by not escaping links.
|
16
|
+
const originalEscape = TurndownService.prototype.escape;
|
17
|
+
function escape(string) {
|
18
|
+
string = originalEscape(string);
|
19
|
+
// Escape "<".
|
20
|
+
string = string.replace(/</g, '\\<');
|
21
|
+
return string;
|
22
|
+
}
|
23
|
+
TurndownService.prototype.escape = function (string) {
|
24
|
+
// Urls should not be escaped. Our strategy is using a regex to find them and escape everything
|
25
|
+
// which is out of the matches parts.
|
26
|
+
let escaped = '';
|
27
|
+
let lastLinkEnd = 0;
|
28
|
+
for (const match of matchAutolink(string)) {
|
29
|
+
const index = match.index;
|
30
|
+
// Append the substring between the last match and the current one (if anything).
|
31
|
+
if (index > lastLinkEnd) {
|
32
|
+
escaped += escape(string.substring(lastLinkEnd, index));
|
33
|
+
}
|
34
|
+
const matchedURL = match[0];
|
35
|
+
escaped += matchedURL;
|
36
|
+
lastLinkEnd = index + matchedURL.length;
|
37
|
+
}
|
38
|
+
// Add text after the last link or at the string start if no matches.
|
39
|
+
if (lastLinkEnd < string.length) {
|
40
|
+
escaped += escape(string.substring(lastLinkEnd, string.length));
|
41
|
+
}
|
42
|
+
return escaped;
|
43
|
+
};
|
44
|
+
const turndownService = new TurndownService({
|
45
|
+
codeBlockStyle: 'fenced',
|
46
|
+
hr: '---',
|
47
|
+
headingStyle: 'atx'
|
48
|
+
});
|
49
|
+
turndownService.use([
|
50
|
+
gfm,
|
51
|
+
todoList
|
52
|
+
]);
|
53
|
+
/**
|
54
|
+
* Parses HTML to a markdown.
|
55
|
+
*/
|
56
|
+
export default function html2markdown(html) {
|
57
|
+
return turndownService.turndown(html);
|
58
|
+
}
|
59
|
+
export { turndownService };
|
60
|
+
// This is a copy of the original taskListItems rule from turdown-plugin-gfm, with minor changes.
|
61
|
+
function todoList(turndownService) {
|
62
|
+
turndownService.addRule('taskListItems', {
|
63
|
+
filter(node) {
|
64
|
+
return node.type === 'checkbox' &&
|
65
|
+
// Changes here as CKEditor outputs a deeper structure.
|
66
|
+
(node.parentNode.nodeName === 'LI' || node.parentNode.parentNode.nodeName === 'LI');
|
67
|
+
},
|
68
|
+
replacement(content, node) {
|
69
|
+
return (node.checked ? '[x]' : '[ ]') + ' ';
|
70
|
+
}
|
71
|
+
});
|
72
|
+
}
|
73
|
+
// Autolink matcher.
|
74
|
+
const regex = new RegExp(
|
75
|
+
// Prefix.
|
76
|
+
/\b(?:(?:https?|ftp):\/\/|www\.)/.source +
|
77
|
+
// Domain name.
|
78
|
+
/(?![-_])(?:[-_a-z0-9\u00a1-\uffff]{1,63}\.)+(?:[a-z\u00a1-\uffff]{2,63})/.source +
|
79
|
+
// The rest.
|
80
|
+
/(?:[^\s<>]*)/.source, 'gi');
|
81
|
+
/**
|
82
|
+
* Trimming end of link.
|
83
|
+
* https://github.github.com/gfm/#autolinks-extension-
|
84
|
+
*/
|
85
|
+
function* matchAutolink(string) {
|
86
|
+
for (const match of string.matchAll(regex)) {
|
87
|
+
const matched = match[0];
|
88
|
+
const length = autolinkFindEnd(matched);
|
89
|
+
yield Object.assign([matched.substring(0, length)], { index: match.index });
|
90
|
+
// We could adjust regex.lastIndex but it's not needed because what we skipped is for sure not a valid URL.
|
91
|
+
}
|
92
|
+
}
|
93
|
+
/**
|
94
|
+
* Returns the new length of the link (after it would trim trailing characters).
|
95
|
+
*/
|
96
|
+
function autolinkFindEnd(string) {
|
97
|
+
let length = string.length;
|
98
|
+
while (length > 0) {
|
99
|
+
const char = string[length - 1];
|
100
|
+
if ('?!.,:*_~\'"'.includes(char)) {
|
101
|
+
length--;
|
102
|
+
}
|
103
|
+
else if (char == ')') {
|
104
|
+
let openBrackets = 0;
|
105
|
+
for (let i = 0; i < length; i++) {
|
106
|
+
if (string[i] == '(') {
|
107
|
+
openBrackets++;
|
108
|
+
}
|
109
|
+
else if (string[i] == ')') {
|
110
|
+
openBrackets--;
|
111
|
+
}
|
112
|
+
}
|
113
|
+
// If there is fewer opening brackets then closing ones we should remove a closing bracket.
|
114
|
+
if (openBrackets < 0) {
|
115
|
+
length--;
|
116
|
+
}
|
117
|
+
else {
|
118
|
+
break;
|
119
|
+
}
|
120
|
+
}
|
121
|
+
else {
|
122
|
+
break;
|
123
|
+
}
|
124
|
+
}
|
125
|
+
return length;
|
126
|
+
}
|
package/src/index.d.ts
CHANGED
@@ -1,9 +1,9 @@
|
|
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
|
7
|
-
*/
|
8
|
-
export { default as Markdown } from './markdown';
|
9
|
-
import './augmentation';
|
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
|
7
|
+
*/
|
8
|
+
export { default as Markdown } from './markdown';
|
9
|
+
import './augmentation';
|
package/src/index.js
CHANGED
@@ -1,9 +1,9 @@
|
|
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
|
7
|
-
*/
|
8
|
-
export { default as Markdown } from './markdown';
|
9
|
-
import './augmentation';
|
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
|
7
|
+
*/
|
8
|
+
export { default as Markdown } from './markdown';
|
9
|
+
import './augmentation';
|
package/src/markdown.d.ts
CHANGED
@@ -1,23 +1,23 @@
|
|
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/markdown
|
7
|
-
*/
|
8
|
-
import { Plugin, type Editor } from 'ckeditor5/src/core';
|
9
|
-
/**
|
10
|
-
* The GitHub Flavored Markdown (GFM) plugin.
|
11
|
-
*
|
12
|
-
* For a detailed overview, check the {@glink features/markdown Markdown feature} guide.
|
13
|
-
*/
|
14
|
-
export default class Markdown extends Plugin {
|
15
|
-
/**
|
16
|
-
* @inheritDoc
|
17
|
-
*/
|
18
|
-
constructor(editor: Editor);
|
19
|
-
/**
|
20
|
-
* @inheritDoc
|
21
|
-
*/
|
22
|
-
static get pluginName(): "Markdown";
|
23
|
-
}
|
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/markdown
|
7
|
+
*/
|
8
|
+
import { Plugin, type Editor } from 'ckeditor5/src/core';
|
9
|
+
/**
|
10
|
+
* The GitHub Flavored Markdown (GFM) plugin.
|
11
|
+
*
|
12
|
+
* For a detailed overview, check the {@glink features/markdown Markdown feature} guide.
|
13
|
+
*/
|
14
|
+
export default class Markdown extends Plugin {
|
15
|
+
/**
|
16
|
+
* @inheritDoc
|
17
|
+
*/
|
18
|
+
constructor(editor: Editor);
|
19
|
+
/**
|
20
|
+
* @inheritDoc
|
21
|
+
*/
|
22
|
+
static get pluginName(): "Markdown";
|
23
|
+
}
|
package/src/markdown.js
CHANGED
@@ -1,29 +1,29 @@
|
|
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/markdown
|
7
|
-
*/
|
8
|
-
import { Plugin } from 'ckeditor5/src/core';
|
9
|
-
import GFMDataProcessor from './gfmdataprocessor';
|
10
|
-
/**
|
11
|
-
* The GitHub Flavored Markdown (GFM) plugin.
|
12
|
-
*
|
13
|
-
* For a detailed overview, check the {@glink features/markdown Markdown feature} guide.
|
14
|
-
*/
|
15
|
-
export default class Markdown extends Plugin {
|
16
|
-
/**
|
17
|
-
* @inheritDoc
|
18
|
-
*/
|
19
|
-
constructor(editor) {
|
20
|
-
super(editor);
|
21
|
-
editor.data.processor = new GFMDataProcessor(editor.data.viewDocument);
|
22
|
-
}
|
23
|
-
/**
|
24
|
-
* @inheritDoc
|
25
|
-
*/
|
26
|
-
static get pluginName() {
|
27
|
-
return 'Markdown';
|
28
|
-
}
|
29
|
-
}
|
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/markdown
|
7
|
+
*/
|
8
|
+
import { Plugin } from 'ckeditor5/src/core';
|
9
|
+
import GFMDataProcessor from './gfmdataprocessor';
|
10
|
+
/**
|
11
|
+
* The GitHub Flavored Markdown (GFM) plugin.
|
12
|
+
*
|
13
|
+
* For a detailed overview, check the {@glink features/markdown Markdown feature} guide.
|
14
|
+
*/
|
15
|
+
export default class Markdown extends Plugin {
|
16
|
+
/**
|
17
|
+
* @inheritDoc
|
18
|
+
*/
|
19
|
+
constructor(editor) {
|
20
|
+
super(editor);
|
21
|
+
editor.data.processor = new GFMDataProcessor(editor.data.viewDocument);
|
22
|
+
}
|
23
|
+
/**
|
24
|
+
* @inheritDoc
|
25
|
+
*/
|
26
|
+
static get pluginName() {
|
27
|
+
return 'Markdown';
|
28
|
+
}
|
29
|
+
}
|
@@ -1,13 +1,13 @@
|
|
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
|
-
/**
|
10
|
-
* Parses markdown string to an HTML.
|
11
|
-
*/
|
12
|
-
export default function markdown2html(markdown: string): string;
|
13
|
-
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
|
+
/**
|
10
|
+
* Parses markdown string to an HTML.
|
11
|
+
*/
|
12
|
+
export default function markdown2html(markdown: string): string;
|
13
|
+
export { marked };
|