overtype 1.1.5 → 1.1.6
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 +4 -1
- package/dist/overtype.esm.js +12 -7
- package/dist/overtype.esm.js.map +2 -2
- package/dist/overtype.js +12 -7
- package/dist/overtype.js.map +2 -2
- package/dist/overtype.min.js +2 -2
- package/package.json +1 -1
- package/src/parser.js +26 -11
package/dist/overtype.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* OverType v1.1.
|
|
2
|
+
* OverType v1.1.6
|
|
3
3
|
* A lightweight markdown editor library with perfect WYSIWYG alignment
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @author Demo User
|
|
@@ -172,7 +172,7 @@ var OverType = (() => {
|
|
|
172
172
|
static parseLinks(html) {
|
|
173
173
|
return html.replace(/\[(.+?)\]\((.+?)\)/g, (match, text, url) => {
|
|
174
174
|
const anchorName = `--link-${this.linkIndex++}`;
|
|
175
|
-
return `<a href="${url}" style="anchor-name: ${anchorName}"><span class="syntax-marker">[</span>${text}<span class="syntax-marker">](</span><span class="syntax-marker">${url}</span><span class="syntax-marker">)</span></a>`;
|
|
175
|
+
return `<a href="${url}" style="anchor-name: ${anchorName}"><span class="syntax-marker">[</span>${text}<span class="syntax-marker">](</span><span class="syntax-marker link-url">${url}</span><span class="syntax-marker">)</span></a>`;
|
|
176
176
|
});
|
|
177
177
|
}
|
|
178
178
|
/**
|
|
@@ -183,17 +183,22 @@ var OverType = (() => {
|
|
|
183
183
|
static parseInlineElements(text) {
|
|
184
184
|
let html = text;
|
|
185
185
|
html = this.parseInlineCode(html);
|
|
186
|
-
const
|
|
186
|
+
const sanctuaries = /* @__PURE__ */ new Map();
|
|
187
187
|
html = html.replace(/(<code>.*?<\/code>)/g, (match) => {
|
|
188
|
-
const placeholder = `\uE000${
|
|
189
|
-
|
|
188
|
+
const placeholder = `\uE000${sanctuaries.size}\uE001`;
|
|
189
|
+
sanctuaries.set(placeholder, match);
|
|
190
190
|
return placeholder;
|
|
191
191
|
});
|
|
192
192
|
html = this.parseLinks(html);
|
|
193
|
+
html = html.replace(/(<a[^>]*>.*?<\/a>)/g, (match) => {
|
|
194
|
+
const placeholder = `\uE000${sanctuaries.size}\uE001`;
|
|
195
|
+
sanctuaries.set(placeholder, match);
|
|
196
|
+
return placeholder;
|
|
197
|
+
});
|
|
193
198
|
html = this.parseBold(html);
|
|
194
199
|
html = this.parseItalic(html);
|
|
195
|
-
|
|
196
|
-
html = html.replace(placeholder,
|
|
200
|
+
sanctuaries.forEach((content, placeholder) => {
|
|
201
|
+
html = html.replace(placeholder, content);
|
|
197
202
|
});
|
|
198
203
|
return html;
|
|
199
204
|
}
|