edytor 7.0.2 → 7.0.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/README.md +2 -2
- package/dist/export/markdown.js +30 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
Edytor aims to be for Svelte what Slate.js is for React: a heavily customizable editor with an API to build any kind of collaborative rich text editor.
|
|
19
19
|
|
|
20
|
-
> **7.0.** Edytor `7.0.
|
|
20
|
+
> **7.0.** Edytor `7.0.3` is on npm as `edytor`: its API follows semantic versioning, and every change is listed in the changelog. It has no production track record yet: read the [limitations](https://edytor.dev/docs/reference/limitations) before you build on it. Issues and PRs are welcome: when you report a bug, include the document's JSON value.
|
|
21
21
|
|
|
22
22
|
## Features
|
|
23
23
|
|
|
@@ -40,7 +40,7 @@ Edytor aims to be for Svelte what Slate.js is for React: a heavily customizable
|
|
|
40
40
|
|
|
41
41
|
## Install
|
|
42
42
|
|
|
43
|
-
Edytor `7.0.
|
|
43
|
+
Edytor `7.0.3` is on npm under `latest`:
|
|
44
44
|
|
|
45
45
|
```bash
|
|
46
46
|
pnpm add edytor
|
package/dist/export/markdown.js
CHANGED
|
@@ -108,6 +108,35 @@ const callouts = {
|
|
|
108
108
|
return component(CALLOUT, icon ? { icon: icon[1] } : {}, context.parseBlocks(body.join('\n')));
|
|
109
109
|
}
|
|
110
110
|
};
|
|
111
|
+
const QUOTED = /^ {0,3}>\s?(.*)$/;
|
|
112
|
+
/** A line a lazy continuation stops at: blank, or a block's start. */
|
|
113
|
+
const BLOCK_START = /^\s*$|^ {0,3}(?:[#>`~*+-]|\d+[.)]|\|)/;
|
|
114
|
+
/**
|
|
115
|
+
* A blockquote as CommonMark reads it: its `>` lines and their lazy
|
|
116
|
+
* continuation lines, a blank line its end (the parser would merge two
|
|
117
|
+
* quotes a blank line apart, and swallow an alert after a quote).
|
|
118
|
+
*/
|
|
119
|
+
const quotes = {
|
|
120
|
+
name: 'edytor-quotes',
|
|
121
|
+
parseBlock(context) {
|
|
122
|
+
if (!QUOTED.test(context.lines[context.index] ?? ''))
|
|
123
|
+
return undefined;
|
|
124
|
+
const body = [];
|
|
125
|
+
let i = context.index;
|
|
126
|
+
for (; i < context.lines.length; i++) {
|
|
127
|
+
const line = context.lines[i];
|
|
128
|
+
const quoted = QUOTED.exec(line);
|
|
129
|
+
if (quoted)
|
|
130
|
+
body.push(quoted[1]);
|
|
131
|
+
else if (!BLOCK_START.test(line) && body.at(-1)?.trim())
|
|
132
|
+
body.push(line);
|
|
133
|
+
else
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
context.consume(i - context.index);
|
|
137
|
+
return { type: 'blockquote', children: context.parseBlocks(body.join('\n')) };
|
|
138
|
+
}
|
|
139
|
+
};
|
|
111
140
|
/** A to-do box without its bullet (`[ ] task`) as a to-do item, as the editor's paste reads it. */
|
|
112
141
|
const bareTodos = {
|
|
113
142
|
name: 'edytor-bare-todos',
|
|
@@ -564,7 +593,7 @@ const hardBreaks = (text) => {
|
|
|
564
593
|
.join('\n');
|
|
565
594
|
};
|
|
566
595
|
const STREAMING = streamingMarkdownExtension();
|
|
567
|
-
const OWN = [autolinks, callouts, details, equations, bareTodos];
|
|
596
|
+
const OWN = [autolinks, callouts, quotes, details, equations, bareTodos];
|
|
568
597
|
/** `text` as blocks (see the module comment). */
|
|
569
598
|
export const textToBlocks = (text, { markdown = true, type = 'paragraph', streaming = false, components, onUnknown } = {}) => {
|
|
570
599
|
if (!markdown)
|