@meowdown/core 0.81.1 → 0.81.3
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/dist/index.js +12 -8
- package/dist/style.css +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Priority, Priority as Priority$1, createMarkBuilders, createNodeBuilders, defaultBlockAt, defineBaseCommands, defineBaseKeymap, defineClipboardSerializer, defineCommands, defineHistory, defineKeymap, defineMarkSpec, defineMarkView, defineNodeAttr, defineNodeSpec, definePlugin, findMarkRange, getMarkRange, getMarkType, getNodeType, isAllSelection, isApple, isAtBlockStart, isNodeSelection, isTextSelection, setBlockType, toggleNode, union, unsetBlockType, withPriority, withPriority as withPriority$1, withSkipCodeBlock } from "@prosekit/core";
|
|
1
|
+
import { Priority, Priority as Priority$1, canUseRegexLookbehind, createMarkBuilders, createNodeBuilders, defaultBlockAt, defineBaseCommands, defineBaseKeymap, defineClipboardSerializer, defineCommands, defineHistory, defineKeymap, defineMarkSpec, defineMarkView, defineNodeAttr, defineNodeSpec, definePlugin, findMarkRange, getMarkRange, getMarkType, getNodeType, isAllSelection, isApple, isAtBlockStart, isNodeSelection, isTextSelection, setBlockType, toggleNode, union, unsetBlockType, withPriority, withPriority as withPriority$1, withSkipCodeBlock } from "@prosekit/core";
|
|
2
2
|
import { codeBlockEnterRule, codeBlockInputRule, defineCodeBlockCommands, defineCodeBlockHighlight, defineCodeBlockKeymap, defineCodeBlockPreviewPlugin, defineCodeBlockSpec, isCodeBlockPreviewHiddenDecoration } from "@prosekit/extensions/code-block";
|
|
3
3
|
import { definePlaceholder, definePlaceholder as definePlaceholder$1 } from "@prosekit/extensions/placeholder";
|
|
4
4
|
import { defineSearchCommands, defineSearchQuery, defineSearchStatusHandler, getSearchStatus, getSearchStatus as getSearchStatus$1 } from "@prosekit/extensions/search";
|
|
@@ -17,9 +17,9 @@ import { defineEnterRule } from "@prosekit/extensions/enter-rule";
|
|
|
17
17
|
import { InputRule } from "@prosekit/pm/inputrules";
|
|
18
18
|
import { createTextBlockEnterRule } from "prosemirror-enter-rules";
|
|
19
19
|
import { NO_BREAK_SPACE } from "unicode-by-name";
|
|
20
|
+
import { fromDom } from "hast-util-from-dom";
|
|
20
21
|
import { defaultHandlers } from "hast-util-to-mdast";
|
|
21
22
|
import { defaultHandlers as defaultHandlers$1 } from "mdast-util-to-markdown";
|
|
22
|
-
import rehypeParse from "rehype-parse";
|
|
23
23
|
import rehypeRemark from "rehype-remark";
|
|
24
24
|
import remarkGfm from "remark-gfm";
|
|
25
25
|
import remarkStringify from "remark-stringify";
|
|
@@ -945,7 +945,7 @@ const textToMarkdown = (node, parent, state, info) => {
|
|
|
945
945
|
}, info);
|
|
946
946
|
};
|
|
947
947
|
function createProcessor() {
|
|
948
|
-
return unified().use(
|
|
948
|
+
return unified().use(rehypeRemark, { handlers: {
|
|
949
949
|
mark: markToHighlight,
|
|
950
950
|
li: taskAwareListItem
|
|
951
951
|
} }).use(remarkGfm).use(remarkStringify, {
|
|
@@ -967,8 +967,11 @@ const getProcessor = once(createProcessor);
|
|
|
967
967
|
/**
|
|
968
968
|
* Convert HTML into Markdown text.
|
|
969
969
|
*/
|
|
970
|
-
function htmlToMarkdown(html) {
|
|
971
|
-
|
|
970
|
+
function htmlToMarkdown(html, parser) {
|
|
971
|
+
const processor = getProcessor();
|
|
972
|
+
const domDoc = (parser ?? new window.DOMParser()).parseFromString(html, "text/html");
|
|
973
|
+
const hast = fromDom(domDoc);
|
|
974
|
+
return processor.stringify(processor.runSync(hast));
|
|
972
975
|
}
|
|
973
976
|
|
|
974
977
|
//#endregion
|
|
@@ -7064,7 +7067,7 @@ function defineSoftBreak() {
|
|
|
7064
7067
|
//#region src/extensions/substitution.ts
|
|
7065
7068
|
const SUBSTITUTION_RULES = [
|
|
7066
7069
|
[/<-/, "←"],
|
|
7067
|
-
[
|
|
7070
|
+
[new RegExp((canUseRegexLookbehind() ? "(?<!-)" : "") + "->"), "→"],
|
|
7068
7071
|
[/\(c\)/, "©"],
|
|
7069
7072
|
[/\(r\)/, "®"],
|
|
7070
7073
|
[/1\/2/, "½"],
|
|
@@ -7072,7 +7075,7 @@ const SUBSTITUTION_RULES = [
|
|
|
7072
7075
|
[/!=/, "≠"],
|
|
7073
7076
|
[/<</, "«"],
|
|
7074
7077
|
[/>>/, "»"],
|
|
7075
|
-
[
|
|
7078
|
+
[new RegExp((canUseRegexLookbehind() ? String.raw`(?<!<!)(?<!^(?:-[ \t]*)+)` : "") + "--"), "—"]
|
|
7076
7079
|
];
|
|
7077
7080
|
const substitutionUndoKey = new PluginKey("meowdown-substitution-undo");
|
|
7078
7081
|
function isInlineCode(state, from, to) {
|
|
@@ -8127,7 +8130,8 @@ function getVirtualElementFromRange(view, range) {
|
|
|
8127
8130
|
};
|
|
8128
8131
|
return {
|
|
8129
8132
|
getBoundingClientRect,
|
|
8130
|
-
getClientRects: () => [getBoundingClientRect()]
|
|
8133
|
+
getClientRects: () => [getBoundingClientRect()],
|
|
8134
|
+
contextElement: view.dom
|
|
8131
8135
|
};
|
|
8132
8136
|
}
|
|
8133
8137
|
|
package/dist/style.css
CHANGED
|
@@ -955,7 +955,7 @@
|
|
|
955
955
|
top var(--meowdown-caret-glide) cubic-bezier(.25, 1, .5, 1),
|
|
956
956
|
height var(--meowdown-caret-glide) cubic-bezier(.25, 1, .5, 1);
|
|
957
957
|
border-radius: 999px;
|
|
958
|
-
margin-left:
|
|
958
|
+
margin-left: .3px;
|
|
959
959
|
display: none;
|
|
960
960
|
position: absolute;
|
|
961
961
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meowdown/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.81.
|
|
4
|
+
"version": "0.81.3",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"@prosekit/extensions": "^0.18.4",
|
|
36
36
|
"@prosekit/pm": "^0.1.20",
|
|
37
37
|
"@prosekit/web": "^0.9.4",
|
|
38
|
+
"hast-util-from-dom": "^5.0.1",
|
|
38
39
|
"hast-util-to-mdast": "^10.1.2",
|
|
39
40
|
"katex": "^0.19.0",
|
|
40
41
|
"lru.min": "^1.1.5",
|
|
@@ -44,7 +45,6 @@
|
|
|
44
45
|
"prosemirror-enter-rules": "^0.1.6",
|
|
45
46
|
"prosemirror-flat-list": "^0.7.3",
|
|
46
47
|
"prosemirror-highlight": "^0.16.0",
|
|
47
|
-
"rehype-parse": "^9.0.1",
|
|
48
48
|
"rehype-remark": "^10.0.1",
|
|
49
49
|
"remark-gfm": "^4.0.1",
|
|
50
50
|
"remark-stringify": "^11.0.0",
|
|
@@ -58,11 +58,11 @@
|
|
|
58
58
|
"@tsdown/css": "^0.23.1",
|
|
59
59
|
"@types/hast": "^3.0.5",
|
|
60
60
|
"@types/mdast": "^4.0.4",
|
|
61
|
-
"@vitest/browser-playwright": "^5.0.
|
|
61
|
+
"@vitest/browser-playwright": "^5.0.5",
|
|
62
62
|
"dedent": "^1.7.2",
|
|
63
63
|
"diffable-html-snapshot": "^0.3.0",
|
|
64
64
|
"tsdown": "^0.23.1",
|
|
65
|
-
"vitest": "^5.0.
|
|
65
|
+
"vitest": "^5.0.5"
|
|
66
66
|
},
|
|
67
67
|
"publishConfig": {
|
|
68
68
|
"access": "public"
|