mdsquare 0.2.0 → 0.3.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/dist/task.js CHANGED
@@ -47,6 +47,7 @@ const CONTAINERS = new Set([
47
47
  "BulletList",
48
48
  "OrderedList",
49
49
  "ListItem",
50
+ "FootnoteDefinition",
50
51
  ]);
51
52
  // ---------------------------------------------------------------------------
52
53
  // 플러그인
package/dist/tikz.js CHANGED
@@ -230,7 +230,7 @@ class TikzWidget extends WidgetType {
230
230
  return false;
231
231
  }
232
232
  }
233
- const CONTAINERS = new Set(["Document", "Blockquote", "BulletList", "OrderedList", "ListItem"]);
233
+ const CONTAINERS = new Set(["Document", "Blockquote", "BulletList", "OrderedList", "ListItem", "FootnoteDefinition"]);
234
234
  function scanTikz(state, languages) {
235
235
  const { doc } = state;
236
236
  const found = [];
@@ -0,0 +1,6 @@
1
+ /** 넓은 글자(한글, 한자, 가나, 전각, 이모지)는 2칸, 나머지는 1칸 */
2
+ export declare const WIDE_CHAR: RegExp;
3
+ /** 글자 하나의 폭 (칸) */
4
+ export declare const charWidth: (ch: string) => number;
5
+ /** 글의 폭 (칸) */
6
+ export declare function displayWidth(text: string): number;
@@ -0,0 +1,11 @@
1
+ /** 넓은 글자(한글, 한자, 가나, 전각, 이모지)는 2칸, 나머지는 1칸 */
2
+ export const WIDE_CHAR = /[\u1100-\u115F\u2E80-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFF60\uFFE0-\uFFE6\u{1F300}-\u{1FAFF}\u{20000}-\u{3FFFD}]/u;
3
+ /** 글자 하나의 폭 (칸) */
4
+ export const charWidth = (ch) => (WIDE_CHAR.test(ch) ? 2 : 1);
5
+ /** 글의 폭 (칸) */
6
+ export function displayWidth(text) {
7
+ let width = 0;
8
+ for (const ch of text)
9
+ width += charWidth(ch);
10
+ return width;
11
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mdsquare",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Hybrid (live preview) Markdown editor built on CodeMirror 6: tables, callouts, math, code blocks, footnotes and more",
5
5
  "keywords": [
6
6
  "markdown",