@ckeditor/ckeditor5-markdown-gfm 0.0.0-nightly-20240117.0 → 0.0.0-nightly-20240119.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.
Potentially problematic release.
This version of @ckeditor/ckeditor5-markdown-gfm might be problematic. Click here for more details.
package/README.md
CHANGED
@@ -9,11 +9,12 @@ This package implements the GitHub Flavored Markdown data processor for CKEditor
|
|
9
9
|
|
10
10
|
## Demo
|
11
11
|
|
12
|
-
Check out the [demo in the Markdown output feature guide](https://ckeditor.com/docs/ckeditor5/latest/features/markdown.html#demo).
|
12
|
+
Check out the [demo in the Markdown output feature guide](https://ckeditor.com/docs/ckeditor5/latest/features/markdown.html#demo) to see the editor configured to input and output Markdown code. Use the [demo in the Paste Markdown feature guide](https://ckeditor.com/docs/ckeditor5/latest/features/pasting/paste-markdown.html#demo) to try out experimental pasting Markdown-formatted content straight into the editor.
|
13
13
|
|
14
14
|
## Documentation
|
15
15
|
|
16
|
-
See the [`@ckeditor/ckeditor5-markdown-gfm` package](https://ckeditor.com/docs/ckeditor5/latest/api/markdown-gfm.html) page in [CKEditor 5 documentation](https://ckeditor.com/docs/ckeditor5/latest/).
|
16
|
+
See the [`@ckeditor/ckeditor5-markdown-gfm` package](https://ckeditor.com/docs/ckeditor5/latest/api/markdown-gfm.html) page as well as the [Markdown output](https://ckeditor.com/docs/ckeditor5/latest/features/markdown.html) and [Paste Markdown](https://ckeditor.com/docs/ckeditor5/latest/features/pasting/paste-markdown.html) in [CKEditor 5 documentation](https://ckeditor.com/docs/ckeditor5/latest/).
|
17
|
+
|
17
18
|
|
18
19
|
## License
|
19
20
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ckeditor/ckeditor5-markdown-gfm",
|
3
|
-
"version": "0.0.0-nightly-
|
3
|
+
"version": "0.0.0-nightly-20240119.0",
|
4
4
|
"description": "GitHub Flavored Markdown data processor for CKEditor 5.",
|
5
5
|
"keywords": [
|
6
6
|
"ckeditor",
|
@@ -13,7 +13,7 @@
|
|
13
13
|
"type": "module",
|
14
14
|
"main": "src/index.js",
|
15
15
|
"dependencies": {
|
16
|
-
"ckeditor5": "0.0.0-nightly-
|
16
|
+
"ckeditor5": "0.0.0-nightly-20240119.0",
|
17
17
|
"marked": "4.0.12",
|
18
18
|
"turndown": "6.0.0",
|
19
19
|
"turndown-plugin-gfm": "1.0.2"
|
@@ -34,23 +34,23 @@ export default class PasteFromMarkdownExperimental extends Plugin {
|
|
34
34
|
*/
|
35
35
|
init(): void;
|
36
36
|
/**
|
37
|
-
* Determines if code copied from a website in `text/html` type can be parsed as
|
38
|
-
* It removes any OS
|
37
|
+
* Determines if the code copied from a website in the `text/html` type can be parsed as Markdown.
|
38
|
+
* It removes any OS-specific HTML tags, for example, <meta> on macOS and <!--StartFragment--> on Windows.
|
39
39
|
* Then removes a single wrapper HTML tag or wrappers for sibling tags, and if there are no more tags left,
|
40
|
-
* returns the remaining text. Returns null
|
40
|
+
* returns the remaining text. Returns null if there are any remaining HTML tags detected.
|
41
41
|
*
|
42
|
-
* @param htmlString Clipboard content in `text/html` type format.
|
42
|
+
* @param htmlString Clipboard content in the `text/html` type format.
|
43
43
|
*/
|
44
44
|
private _parseMarkdownFromHtml;
|
45
45
|
/**
|
46
|
-
* Removes OS
|
46
|
+
* Removes OS-specific tags.
|
47
47
|
*
|
48
|
-
* @param htmlString Clipboard content in `text/html` type format.
|
48
|
+
* @param htmlString Clipboard content in the `text/html` type format.
|
49
49
|
*/
|
50
50
|
private _removeOsSpecificTags;
|
51
51
|
/**
|
52
|
-
* If the input HTML string contains any first
|
53
|
-
* like <b>, <strong
|
52
|
+
* If the input HTML string contains any first-level formatting tags
|
53
|
+
* like <b>, <strong>, or <i>, we should not treat it as Markdown.
|
54
54
|
*
|
55
55
|
* @param htmlString Clipboard content.
|
56
56
|
*/
|
@@ -58,11 +58,11 @@ export default class PasteFromMarkdownExperimental extends Plugin {
|
|
58
58
|
/**
|
59
59
|
* Removes multiple HTML wrapper tags from a list of sibling HTML tags.
|
60
60
|
*
|
61
|
-
* @param htmlString Clipboard content without any OS
|
61
|
+
* @param htmlString Clipboard content without any OS-specific tags.
|
62
62
|
*/
|
63
63
|
private _removeFirstLevelWrapperTagsAndBrs;
|
64
64
|
/**
|
65
|
-
* Determines if string contains any HTML tags.
|
65
|
+
* Determines if a string contains any HTML tags.
|
66
66
|
*/
|
67
67
|
private _containsAnyRemainingHtmlTags;
|
68
68
|
/**
|
@@ -63,12 +63,12 @@ export default class PasteFromMarkdownExperimental extends Plugin {
|
|
63
63
|
});
|
64
64
|
}
|
65
65
|
/**
|
66
|
-
* Determines if code copied from a website in `text/html` type can be parsed as
|
67
|
-
* It removes any OS
|
66
|
+
* Determines if the code copied from a website in the `text/html` type can be parsed as Markdown.
|
67
|
+
* It removes any OS-specific HTML tags, for example, <meta> on macOS and <!--StartFragment--> on Windows.
|
68
68
|
* Then removes a single wrapper HTML tag or wrappers for sibling tags, and if there are no more tags left,
|
69
|
-
* returns the remaining text. Returns null
|
69
|
+
* returns the remaining text. Returns null if there are any remaining HTML tags detected.
|
70
70
|
*
|
71
|
-
* @param htmlString Clipboard content in `text/html` type format.
|
71
|
+
* @param htmlString Clipboard content in the `text/html` type format.
|
72
72
|
*/
|
73
73
|
_parseMarkdownFromHtml(htmlString) {
|
74
74
|
const withoutOsSpecificTags = this._removeOsSpecificTags(htmlString);
|
@@ -82,23 +82,23 @@ export default class PasteFromMarkdownExperimental extends Plugin {
|
|
82
82
|
return this._replaceHtmlReservedEntitiesWithCharacters(withoutWrapperTag);
|
83
83
|
}
|
84
84
|
/**
|
85
|
-
* Removes OS
|
85
|
+
* Removes OS-specific tags.
|
86
86
|
*
|
87
|
-
* @param htmlString Clipboard content in `text/html` type format.
|
87
|
+
* @param htmlString Clipboard content in the `text/html` type format.
|
88
88
|
*/
|
89
89
|
_removeOsSpecificTags(htmlString) {
|
90
|
-
// Removing <meta> tag present on Mac.
|
90
|
+
// Removing the <meta> tag present on Mac.
|
91
91
|
const withoutMetaTag = htmlString.replace(/^<meta\b[^>]*>/, '').trim();
|
92
|
-
// Removing <html> tag present on Windows.
|
92
|
+
// Removing the <html> tag present on Windows.
|
93
93
|
const withoutHtmlTag = withoutMetaTag.replace(/^<html>/, '').replace(/<\/html>$/, '').trim();
|
94
|
-
// Removing <body> tag present on Windows.
|
94
|
+
// Removing the <body> tag present on Windows.
|
95
95
|
const withoutBodyTag = withoutHtmlTag.replace(/^<body>/, '').replace(/<\/body>$/, '').trim();
|
96
|
-
// Removing <!--StartFragment--> tag present on Windows.
|
96
|
+
// Removing the <!--StartFragment--> tag present on Windows.
|
97
97
|
return withoutBodyTag.replace(/^<!--StartFragment-->/, '').replace(/<!--EndFragment-->$/, '').trim();
|
98
98
|
}
|
99
99
|
/**
|
100
|
-
* If the input HTML string contains any first
|
101
|
-
* like <b>, <strong
|
100
|
+
* If the input HTML string contains any first-level formatting tags
|
101
|
+
* like <b>, <strong>, or <i>, we should not treat it as Markdown.
|
102
102
|
*
|
103
103
|
* @param htmlString Clipboard content.
|
104
104
|
*/
|
@@ -111,7 +111,7 @@ export default class PasteFromMarkdownExperimental extends Plugin {
|
|
111
111
|
/**
|
112
112
|
* Removes multiple HTML wrapper tags from a list of sibling HTML tags.
|
113
113
|
*
|
114
|
-
* @param htmlString Clipboard content without any OS
|
114
|
+
* @param htmlString Clipboard content without any OS-specific tags.
|
115
115
|
*/
|
116
116
|
_removeFirstLevelWrapperTagsAndBrs(htmlString) {
|
117
117
|
const parser = new DOMParser();
|
@@ -128,7 +128,7 @@ export default class PasteFromMarkdownExperimental extends Plugin {
|
|
128
128
|
return tempElement.innerHTML;
|
129
129
|
}
|
130
130
|
/**
|
131
|
-
* Determines if string contains any HTML tags.
|
131
|
+
* Determines if a string contains any HTML tags.
|
132
132
|
*/
|
133
133
|
_containsAnyRemainingHtmlTags(str) {
|
134
134
|
return str.includes('<');
|