@tiptap/extension-typography 2.11.7 → 3.0.0-beta.1
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/LICENSE.md +21 -0
- package/README.md +5 -1
- package/dist/index.cjs +264 -219
- package/dist/index.cjs.map +1 -1
- package/dist/{typography.d.ts → index.d.cts} +28 -25
- package/dist/index.d.ts +144 -4
- package/dist/index.js +217 -194
- package/dist/index.js.map +1 -1
- package/package.json +10 -8
- package/src/typography.ts +153 -131
- package/dist/index.d.ts.map +0 -1
- package/dist/index.umd.js +0 -227
- package/dist/index.umd.js.map +0 -1
- package/dist/typography.d.ts.map +0 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/typography.ts"],"sourcesContent":["import { Extension, textInputRule } from '@tiptap/core'\n\nexport interface TypographyOptions {\n /**\n * The em dash character.\n * @default '—'\n */\n emDash: false | string,\n\n /**\n * The ellipsis character.\n * @default '…'\n */\n ellipsis: false | string,\n\n /**\n * The open double quote character.\n * @default '“'\n */\n openDoubleQuote: false | string,\n\n /**\n * The close double quote character.\n * @default '”'\n */\n closeDoubleQuote: false | string,\n\n /**\n * The open single quote character.\n * @default '‘'\n */\n openSingleQuote: false | string,\n\n /**\n * The close single quote character.\n * @default '’'\n */\n closeSingleQuote: false | string,\n\n /**\n * The left arrow character.\n * @default '←'\n */\n leftArrow: false | string,\n\n /**\n * The right arrow character.\n * @default '→'\n */\n rightArrow: false | string,\n\n /**\n * The copyright character.\n * @default '©'\n */\n copyright: false | string,\n\n /**\n * The trademark character.\n * @default '™'\n */\n trademark: false | string,\n\n /**\n * The servicemark character.\n * @default '℠'\n */\n servicemark: false | string,\n\n /**\n * The registered trademark character.\n * @default '®'\n */\n registeredTrademark: false | string,\n\n /**\n * The one half character.\n * @default '½'\n */\n oneHalf: false | string,\n\n /**\n * The plus minus character.\n * @default '±'\n */\n plusMinus: false | string,\n\n /**\n * The not equal character.\n * @default '≠'\n */\n notEqual: false | string,\n\n /**\n * The laquo character.\n * @default '«'\n */\n laquo: false | string,\n\n /**\n * The raquo character.\n * @default '»'\n */\n raquo: false | string,\n\n /**\n * The multiplication character.\n * @default '×'\n */\n multiplication: false | string,\n\n /**\n * The superscript two character.\n * @default '²'\n */\n superscriptTwo: false | string,\n\n /**\n * The superscript three character.\n * @default '³'\n */\n superscriptThree: false | string,\n\n /**\n * The one quarter character.\n * @default '¼'\n */\n oneQuarter: false | string,\n\n /**\n * The three quarters character.\n * @default '¾'\n */\n threeQuarters: false | string,\n}\n\nexport const emDash = (override?: string) => textInputRule({\n find: /--$/,\n replace: override ?? '—',\n})\n\nexport const ellipsis = (override?: string) => textInputRule({\n find: /\\.\\.\\.$/,\n replace: override ?? '…',\n})\n\nexport const openDoubleQuote = (override?: string) => textInputRule({\n find: /(?:^|[\\s{[(<'\"\\u2018\\u201C])(\")$/,\n replace: override ?? '“',\n})\n\nexport const closeDoubleQuote = (override?: string) => textInputRule({\n find: /\"$/,\n replace: override ?? '”',\n})\n\nexport const openSingleQuote = (override?: string) => textInputRule({\n find: /(?:^|[\\s{[(<'\"\\u2018\\u201C])(')$/,\n replace: override ?? '‘',\n})\n\nexport const closeSingleQuote = (override?: string) => textInputRule({\n find: /'$/,\n replace: override ?? '’',\n})\n\nexport const leftArrow = (override?: string) => textInputRule({\n find: /<-$/,\n replace: override ?? '←',\n})\n\nexport const rightArrow = (override?: string) => textInputRule({\n find: /->$/,\n replace: override ?? '→',\n})\n\nexport const copyright = (override?: string) => textInputRule({\n find: /\\(c\\)$/,\n replace: override ?? '©',\n})\n\nexport const trademark = (override?: string) => textInputRule({\n find: /\\(tm\\)$/,\n replace: override ?? '™',\n})\n\nexport const servicemark = (override?: string) => textInputRule({\n find: /\\(sm\\)$/,\n replace: override ?? '℠',\n})\n\nexport const registeredTrademark = (override?: string) => textInputRule({\n find: /\\(r\\)$/,\n replace: override ?? '®',\n})\n\nexport const oneHalf = (override?: string) => textInputRule({\n find: /(?:^|\\s)(1\\/2)\\s$/,\n replace: override ?? '½',\n})\n\nexport const plusMinus = (override?: string) => textInputRule({\n find: /\\+\\/-$/,\n replace: override ?? '±',\n})\n\nexport const notEqual = (override?: string) => textInputRule({\n find: /!=$/,\n replace: override ?? '≠',\n})\n\nexport const laquo = (override?: string) => textInputRule({\n find: /<<$/,\n replace: override ?? '«',\n})\n\nexport const raquo = (override?: string) => textInputRule({\n find: />>$/,\n replace: override ?? '»',\n})\n\nexport const multiplication = (override?: string) => textInputRule({\n find: /\\d+\\s?([*x])\\s?\\d+$/,\n replace: override ?? '×',\n})\n\nexport const superscriptTwo = (override?: string) => textInputRule({\n find: /\\^2$/,\n replace: override ?? '²',\n})\n\nexport const superscriptThree = (override?: string) => textInputRule({\n find: /\\^3$/,\n replace: override ?? '³',\n})\n\nexport const oneQuarter = (override?: string) => textInputRule({\n find: /(?:^|\\s)(1\\/4)\\s$/,\n replace: override ?? '¼',\n})\n\nexport const threeQuarters = (override?: string) => textInputRule({\n find: /(?:^|\\s)(3\\/4)\\s$/,\n replace: override ?? '¾',\n})\n\n/**\n * This extension allows you to add typography replacements for specific characters.\n * @see https://www.tiptap.dev/api/extensions/typography\n */\nexport const Typography = Extension.create<TypographyOptions>({\n name: 'typography',\n\n addOptions() {\n return {\n closeDoubleQuote: '”',\n closeSingleQuote: '’',\n copyright: '©',\n ellipsis: '…',\n emDash: '—',\n laquo: '«',\n leftArrow: '←',\n multiplication: '×',\n notEqual: '≠',\n oneHalf: '½',\n oneQuarter: '¼',\n openDoubleQuote: '“',\n openSingleQuote: '‘',\n plusMinus: '±',\n raquo: '»',\n registeredTrademark: '®',\n rightArrow: '→',\n servicemark: '℠',\n superscriptThree: '³',\n superscriptTwo: '²',\n threeQuarters: '¾',\n trademark: '™',\n }\n },\n\n addInputRules() {\n const rules = []\n\n if (this.options.emDash !== false) {\n rules.push(emDash(this.options.emDash))\n }\n\n if (this.options.ellipsis !== false) {\n rules.push(ellipsis(this.options.ellipsis))\n }\n\n if (this.options.openDoubleQuote !== false) {\n rules.push(openDoubleQuote(this.options.openDoubleQuote))\n }\n\n if (this.options.closeDoubleQuote !== false) {\n rules.push(closeDoubleQuote(this.options.closeDoubleQuote))\n }\n\n if (this.options.openSingleQuote !== false) {\n rules.push(openSingleQuote(this.options.openSingleQuote))\n }\n\n if (this.options.closeSingleQuote !== false) {\n rules.push(closeSingleQuote(this.options.closeSingleQuote))\n }\n\n if (this.options.leftArrow !== false) {\n rules.push(leftArrow(this.options.leftArrow))\n }\n\n if (this.options.rightArrow !== false) {\n rules.push(rightArrow(this.options.rightArrow))\n }\n\n if (this.options.copyright !== false) {\n rules.push(copyright(this.options.copyright))\n }\n\n if (this.options.trademark !== false) {\n rules.push(trademark(this.options.trademark))\n }\n\n if (this.options.servicemark !== false) {\n rules.push(servicemark(this.options.servicemark))\n }\n\n if (this.options.registeredTrademark !== false) {\n rules.push(registeredTrademark(this.options.registeredTrademark))\n }\n\n if (this.options.oneHalf !== false) {\n rules.push(oneHalf(this.options.oneHalf))\n }\n\n if (this.options.plusMinus !== false) {\n rules.push(plusMinus(this.options.plusMinus))\n }\n\n if (this.options.notEqual !== false) {\n rules.push(notEqual(this.options.notEqual))\n }\n\n if (this.options.laquo !== false) {\n rules.push(laquo(this.options.laquo))\n }\n\n if (this.options.raquo !== false) {\n rules.push(raquo(this.options.raquo))\n }\n\n if (this.options.multiplication !== false) {\n rules.push(multiplication(this.options.multiplication))\n }\n\n if (this.options.superscriptTwo !== false) {\n rules.push(superscriptTwo(this.options.superscriptTwo))\n }\n\n if (this.options.superscriptThree !== false) {\n rules.push(superscriptThree(this.options.superscriptThree))\n }\n\n if (this.options.oneQuarter !== false) {\n rules.push(oneQuarter(this.options.oneQuarter))\n }\n\n if (this.options.threeQuarters !== false) {\n rules.push(threeQuarters(this.options.threeQuarters))\n }\n\n return rules\n },\n})\n"],"names":[],"mappings":";;AAwIa,MAAA,MAAM,GAAG,CAAC,QAAiB,KAA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|
+
{"version":3,"sources":["../src/typography.ts","../src/index.ts"],"sourcesContent":["import { Extension, textInputRule } from '@tiptap/core'\n\nexport interface TypographyOptions {\n /**\n * The em dash character.\n * @default '—'\n */\n emDash: false | string\n\n /**\n * The ellipsis character.\n * @default '…'\n */\n ellipsis: false | string\n\n /**\n * The open double quote character.\n * @default '“'\n */\n openDoubleQuote: false | string\n\n /**\n * The close double quote character.\n * @default '”'\n */\n closeDoubleQuote: false | string\n\n /**\n * The open single quote character.\n * @default '‘'\n */\n openSingleQuote: false | string\n\n /**\n * The close single quote character.\n * @default '’'\n */\n closeSingleQuote: false | string\n\n /**\n * The left arrow character.\n * @default '←'\n */\n leftArrow: false | string\n\n /**\n * The right arrow character.\n * @default '→'\n */\n rightArrow: false | string\n\n /**\n * The copyright character.\n * @default '©'\n */\n copyright: false | string\n\n /**\n * The trademark character.\n * @default '™'\n */\n trademark: false | string\n\n /**\n * The servicemark character.\n * @default '℠'\n */\n servicemark: false | string\n\n /**\n * The registered trademark character.\n * @default '®'\n */\n registeredTrademark: false | string\n\n /**\n * The one half character.\n * @default '½'\n */\n oneHalf: false | string\n\n /**\n * The plus minus character.\n * @default '±'\n */\n plusMinus: false | string\n\n /**\n * The not equal character.\n * @default '≠'\n */\n notEqual: false | string\n\n /**\n * The laquo character.\n * @default '«'\n */\n laquo: false | string\n\n /**\n * The raquo character.\n * @default '»'\n */\n raquo: false | string\n\n /**\n * The multiplication character.\n * @default '×'\n */\n multiplication: false | string\n\n /**\n * The superscript two character.\n * @default '²'\n */\n superscriptTwo: false | string\n\n /**\n * The superscript three character.\n * @default '³'\n */\n superscriptThree: false | string\n\n /**\n * The one quarter character.\n * @default '¼'\n */\n oneQuarter: false | string\n\n /**\n * The three quarters character.\n * @default '¾'\n */\n threeQuarters: false | string\n}\n\nexport const emDash = (override?: string) =>\n textInputRule({\n find: /--$/,\n replace: override ?? '—',\n })\n\nexport const ellipsis = (override?: string) =>\n textInputRule({\n find: /\\.\\.\\.$/,\n replace: override ?? '…',\n })\n\nexport const openDoubleQuote = (override?: string) =>\n textInputRule({\n find: /(?:^|[\\s{[(<'\"\\u2018\\u201C])(\")$/,\n replace: override ?? '“',\n })\n\nexport const closeDoubleQuote = (override?: string) =>\n textInputRule({\n find: /\"$/,\n replace: override ?? '”',\n })\n\nexport const openSingleQuote = (override?: string) =>\n textInputRule({\n find: /(?:^|[\\s{[(<'\"\\u2018\\u201C])(')$/,\n replace: override ?? '‘',\n })\n\nexport const closeSingleQuote = (override?: string) =>\n textInputRule({\n find: /'$/,\n replace: override ?? '’',\n })\n\nexport const leftArrow = (override?: string) =>\n textInputRule({\n find: /<-$/,\n replace: override ?? '←',\n })\n\nexport const rightArrow = (override?: string) =>\n textInputRule({\n find: /->$/,\n replace: override ?? '→',\n })\n\nexport const copyright = (override?: string) =>\n textInputRule({\n find: /\\(c\\)$/,\n replace: override ?? '©',\n })\n\nexport const trademark = (override?: string) =>\n textInputRule({\n find: /\\(tm\\)$/,\n replace: override ?? '™',\n })\n\nexport const servicemark = (override?: string) =>\n textInputRule({\n find: /\\(sm\\)$/,\n replace: override ?? '℠',\n })\n\nexport const registeredTrademark = (override?: string) =>\n textInputRule({\n find: /\\(r\\)$/,\n replace: override ?? '®',\n })\n\nexport const oneHalf = (override?: string) =>\n textInputRule({\n find: /(?:^|\\s)(1\\/2)\\s$/,\n replace: override ?? '½',\n })\n\nexport const plusMinus = (override?: string) =>\n textInputRule({\n find: /\\+\\/-$/,\n replace: override ?? '±',\n })\n\nexport const notEqual = (override?: string) =>\n textInputRule({\n find: /!=$/,\n replace: override ?? '≠',\n })\n\nexport const laquo = (override?: string) =>\n textInputRule({\n find: /<<$/,\n replace: override ?? '«',\n })\n\nexport const raquo = (override?: string) =>\n textInputRule({\n find: />>$/,\n replace: override ?? '»',\n })\n\nexport const multiplication = (override?: string) =>\n textInputRule({\n find: /\\d+\\s?([*x])\\s?\\d+$/,\n replace: override ?? '×',\n })\n\nexport const superscriptTwo = (override?: string) =>\n textInputRule({\n find: /\\^2$/,\n replace: override ?? '²',\n })\n\nexport const superscriptThree = (override?: string) =>\n textInputRule({\n find: /\\^3$/,\n replace: override ?? '³',\n })\n\nexport const oneQuarter = (override?: string) =>\n textInputRule({\n find: /(?:^|\\s)(1\\/4)\\s$/,\n replace: override ?? '¼',\n })\n\nexport const threeQuarters = (override?: string) =>\n textInputRule({\n find: /(?:^|\\s)(3\\/4)\\s$/,\n replace: override ?? '¾',\n })\n\n/**\n * This extension allows you to add typography replacements for specific characters.\n * @see https://www.tiptap.dev/api/extensions/typography\n */\nexport const Typography = Extension.create<TypographyOptions>({\n name: 'typography',\n\n addOptions() {\n return {\n closeDoubleQuote: '”',\n closeSingleQuote: '’',\n copyright: '©',\n ellipsis: '…',\n emDash: '—',\n laquo: '«',\n leftArrow: '←',\n multiplication: '×',\n notEqual: '≠',\n oneHalf: '½',\n oneQuarter: '¼',\n openDoubleQuote: '“',\n openSingleQuote: '‘',\n plusMinus: '±',\n raquo: '»',\n registeredTrademark: '®',\n rightArrow: '→',\n servicemark: '℠',\n superscriptThree: '³',\n superscriptTwo: '²',\n threeQuarters: '¾',\n trademark: '™',\n }\n },\n\n addInputRules() {\n const rules = []\n\n if (this.options.emDash !== false) {\n rules.push(emDash(this.options.emDash))\n }\n\n if (this.options.ellipsis !== false) {\n rules.push(ellipsis(this.options.ellipsis))\n }\n\n if (this.options.openDoubleQuote !== false) {\n rules.push(openDoubleQuote(this.options.openDoubleQuote))\n }\n\n if (this.options.closeDoubleQuote !== false) {\n rules.push(closeDoubleQuote(this.options.closeDoubleQuote))\n }\n\n if (this.options.openSingleQuote !== false) {\n rules.push(openSingleQuote(this.options.openSingleQuote))\n }\n\n if (this.options.closeSingleQuote !== false) {\n rules.push(closeSingleQuote(this.options.closeSingleQuote))\n }\n\n if (this.options.leftArrow !== false) {\n rules.push(leftArrow(this.options.leftArrow))\n }\n\n if (this.options.rightArrow !== false) {\n rules.push(rightArrow(this.options.rightArrow))\n }\n\n if (this.options.copyright !== false) {\n rules.push(copyright(this.options.copyright))\n }\n\n if (this.options.trademark !== false) {\n rules.push(trademark(this.options.trademark))\n }\n\n if (this.options.servicemark !== false) {\n rules.push(servicemark(this.options.servicemark))\n }\n\n if (this.options.registeredTrademark !== false) {\n rules.push(registeredTrademark(this.options.registeredTrademark))\n }\n\n if (this.options.oneHalf !== false) {\n rules.push(oneHalf(this.options.oneHalf))\n }\n\n if (this.options.plusMinus !== false) {\n rules.push(plusMinus(this.options.plusMinus))\n }\n\n if (this.options.notEqual !== false) {\n rules.push(notEqual(this.options.notEqual))\n }\n\n if (this.options.laquo !== false) {\n rules.push(laquo(this.options.laquo))\n }\n\n if (this.options.raquo !== false) {\n rules.push(raquo(this.options.raquo))\n }\n\n if (this.options.multiplication !== false) {\n rules.push(multiplication(this.options.multiplication))\n }\n\n if (this.options.superscriptTwo !== false) {\n rules.push(superscriptTwo(this.options.superscriptTwo))\n }\n\n if (this.options.superscriptThree !== false) {\n rules.push(superscriptThree(this.options.superscriptThree))\n }\n\n if (this.options.oneQuarter !== false) {\n rules.push(oneQuarter(this.options.oneQuarter))\n }\n\n if (this.options.threeQuarters !== false) {\n rules.push(threeQuarters(this.options.threeQuarters))\n }\n\n return rules\n },\n})\n","import { Typography } from './typography.js'\n\nexport * from './typography.js'\n\nexport default Typography\n"],"mappings":";AAAA,SAAS,WAAW,qBAAqB;AAwIlC,IAAM,SAAS,CAAC,aACrB,cAAc;AAAA,EACZ,MAAM;AAAA,EACN,SAAS,8BAAY;AACvB,CAAC;AAEI,IAAM,WAAW,CAAC,aACvB,cAAc;AAAA,EACZ,MAAM;AAAA,EACN,SAAS,8BAAY;AACvB,CAAC;AAEI,IAAM,kBAAkB,CAAC,aAC9B,cAAc;AAAA,EACZ,MAAM;AAAA,EACN,SAAS,8BAAY;AACvB,CAAC;AAEI,IAAM,mBAAmB,CAAC,aAC/B,cAAc;AAAA,EACZ,MAAM;AAAA,EACN,SAAS,8BAAY;AACvB,CAAC;AAEI,IAAM,kBAA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AQ,CAAC;AAAA,IAC5C;AAEA,QAAI,KAAK,QAAQ,UAAU,OAAO;AAChC,YAAM,KAAK,MAAM,KAAK,QAAQ,KAAK,CAAC;AAAA,IACtC;AAEA,QAAI,KAAK,QAAQ,UAAU,OAAO;AAChC,YAAM,KAAK,MAAM,KAAK,QAAQ,KAAK,CAAC;AAAA,IACtC;AAEA,QAAI,KAAK,QAAQ,mBAAmB,OAAO;AACzC,YAAM,KAAK,eAAe,KAAK,QAAQ,cAAc,CAAC;AAAA,IACxD;AAEA,QAAI,KAAK,QAAQ,mBAAmB,OAAO;AACzC,YAAM,KAAK,eAAe,KAAK,QAAQ,cAAc,CAAC;AAAA,IACxD;AAEA,QAAI,KAAK,QAAQ,qBAAqB,OAAO;AAC3C,YAAM,KAAK,iBAAiB,KAAK,QAAQ,gBAAgB,CAAC;AAAA,IAC5D;AAEA,QAAI,KAAK,QAAQ,eAAe,OAAO;AACrC,YAAM,KAAK,WAAW,KAAK,QAAQ,UAAU,CAAC;AAAA,IAChD;AAEA,QAAI,KAAK,QAAQ,kBAAkB,OAAO;AACxC,YAAM,KAAK,cAAc,KAAK,QAAQ,aAAa,CAAC;AAAA,IACtD;AAEA,WAAO;AAAA,EACT;AACF,CAAC;;;ACvYD,IAAO,gBAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiptap/extension-typography",
|
|
3
3
|
"description": "typography extension for tiptap",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "3.0.0-beta.1",
|
|
5
5
|
"homepage": "https://tiptap.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tiptap",
|
|
@@ -15,24 +15,26 @@
|
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
18
|
-
"types":
|
|
18
|
+
"types": {
|
|
19
|
+
"import": "./dist/index.d.ts",
|
|
20
|
+
"require": "./dist/index.d.cts"
|
|
21
|
+
},
|
|
19
22
|
"import": "./dist/index.js",
|
|
20
23
|
"require": "./dist/index.cjs"
|
|
21
24
|
}
|
|
22
25
|
},
|
|
23
26
|
"main": "dist/index.cjs",
|
|
24
27
|
"module": "dist/index.js",
|
|
25
|
-
"umd": "dist/index.umd.js",
|
|
26
28
|
"types": "dist/index.d.ts",
|
|
27
29
|
"files": [
|
|
28
30
|
"src",
|
|
29
31
|
"dist"
|
|
30
32
|
],
|
|
31
33
|
"devDependencies": {
|
|
32
|
-
"@tiptap/core": "^
|
|
34
|
+
"@tiptap/core": "^3.0.0-beta.1"
|
|
33
35
|
},
|
|
34
36
|
"peerDependencies": {
|
|
35
|
-
"@tiptap/core": "^
|
|
37
|
+
"@tiptap/core": "^3.0.0-beta.0"
|
|
36
38
|
},
|
|
37
39
|
"repository": {
|
|
38
40
|
"type": "git",
|
|
@@ -40,7 +42,7 @@
|
|
|
40
42
|
"directory": "packages/extension-typography"
|
|
41
43
|
},
|
|
42
44
|
"scripts": {
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
+
"build": "tsup",
|
|
46
|
+
"lint": "prettier ./src/ --check && eslint --cache --quiet --no-error-on-unmatched-pattern ./src/"
|
|
45
47
|
}
|
|
46
|
-
}
|
|
48
|
+
}
|
package/src/typography.ts
CHANGED
|
@@ -5,244 +5,266 @@ export interface TypographyOptions {
|
|
|
5
5
|
* The em dash character.
|
|
6
6
|
* @default '—'
|
|
7
7
|
*/
|
|
8
|
-
emDash: false | string
|
|
8
|
+
emDash: false | string
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* The ellipsis character.
|
|
12
12
|
* @default '…'
|
|
13
13
|
*/
|
|
14
|
-
ellipsis: false | string
|
|
14
|
+
ellipsis: false | string
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* The open double quote character.
|
|
18
18
|
* @default '“'
|
|
19
19
|
*/
|
|
20
|
-
openDoubleQuote: false | string
|
|
20
|
+
openDoubleQuote: false | string
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* The close double quote character.
|
|
24
24
|
* @default '”'
|
|
25
25
|
*/
|
|
26
|
-
closeDoubleQuote: false | string
|
|
26
|
+
closeDoubleQuote: false | string
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* The open single quote character.
|
|
30
30
|
* @default '‘'
|
|
31
31
|
*/
|
|
32
|
-
openSingleQuote: false | string
|
|
32
|
+
openSingleQuote: false | string
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* The close single quote character.
|
|
36
36
|
* @default '’'
|
|
37
37
|
*/
|
|
38
|
-
closeSingleQuote: false | string
|
|
38
|
+
closeSingleQuote: false | string
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* The left arrow character.
|
|
42
42
|
* @default '←'
|
|
43
43
|
*/
|
|
44
|
-
leftArrow: false | string
|
|
44
|
+
leftArrow: false | string
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* The right arrow character.
|
|
48
48
|
* @default '→'
|
|
49
49
|
*/
|
|
50
|
-
rightArrow: false | string
|
|
50
|
+
rightArrow: false | string
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* The copyright character.
|
|
54
54
|
* @default '©'
|
|
55
55
|
*/
|
|
56
|
-
copyright: false | string
|
|
56
|
+
copyright: false | string
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
59
|
* The trademark character.
|
|
60
60
|
* @default '™'
|
|
61
61
|
*/
|
|
62
|
-
trademark: false | string
|
|
62
|
+
trademark: false | string
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
65
|
* The servicemark character.
|
|
66
66
|
* @default '℠'
|
|
67
67
|
*/
|
|
68
|
-
servicemark: false | string
|
|
68
|
+
servicemark: false | string
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
71
|
* The registered trademark character.
|
|
72
72
|
* @default '®'
|
|
73
73
|
*/
|
|
74
|
-
registeredTrademark: false | string
|
|
74
|
+
registeredTrademark: false | string
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
77
|
* The one half character.
|
|
78
78
|
* @default '½'
|
|
79
79
|
*/
|
|
80
|
-
oneHalf: false | string
|
|
80
|
+
oneHalf: false | string
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
83
|
* The plus minus character.
|
|
84
84
|
* @default '±'
|
|
85
85
|
*/
|
|
86
|
-
plusMinus: false | string
|
|
86
|
+
plusMinus: false | string
|
|
87
87
|
|
|
88
88
|
/**
|
|
89
89
|
* The not equal character.
|
|
90
90
|
* @default '≠'
|
|
91
91
|
*/
|
|
92
|
-
notEqual: false | string
|
|
92
|
+
notEqual: false | string
|
|
93
93
|
|
|
94
94
|
/**
|
|
95
95
|
* The laquo character.
|
|
96
96
|
* @default '«'
|
|
97
97
|
*/
|
|
98
|
-
laquo: false | string
|
|
98
|
+
laquo: false | string
|
|
99
99
|
|
|
100
100
|
/**
|
|
101
101
|
* The raquo character.
|
|
102
102
|
* @default '»'
|
|
103
103
|
*/
|
|
104
|
-
raquo: false | string
|
|
104
|
+
raquo: false | string
|
|
105
105
|
|
|
106
106
|
/**
|
|
107
107
|
* The multiplication character.
|
|
108
108
|
* @default '×'
|
|
109
109
|
*/
|
|
110
|
-
multiplication: false | string
|
|
110
|
+
multiplication: false | string
|
|
111
111
|
|
|
112
112
|
/**
|
|
113
113
|
* The superscript two character.
|
|
114
114
|
* @default '²'
|
|
115
115
|
*/
|
|
116
|
-
superscriptTwo: false | string
|
|
116
|
+
superscriptTwo: false | string
|
|
117
117
|
|
|
118
118
|
/**
|
|
119
119
|
* The superscript three character.
|
|
120
120
|
* @default '³'
|
|
121
121
|
*/
|
|
122
|
-
superscriptThree: false | string
|
|
122
|
+
superscriptThree: false | string
|
|
123
123
|
|
|
124
124
|
/**
|
|
125
125
|
* The one quarter character.
|
|
126
126
|
* @default '¼'
|
|
127
127
|
*/
|
|
128
|
-
oneQuarter: false | string
|
|
128
|
+
oneQuarter: false | string
|
|
129
129
|
|
|
130
130
|
/**
|
|
131
131
|
* The three quarters character.
|
|
132
132
|
* @default '¾'
|
|
133
133
|
*/
|
|
134
|
-
threeQuarters: false | string
|
|
134
|
+
threeQuarters: false | string
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
export const emDash = (override?: string) =>
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
})
|
|
166
|
-
|
|
167
|
-
export const
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
})
|
|
196
|
-
|
|
197
|
-
export const
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
})
|
|
226
|
-
|
|
227
|
-
export const
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
137
|
+
export const emDash = (override?: string) =>
|
|
138
|
+
textInputRule({
|
|
139
|
+
find: /--$/,
|
|
140
|
+
replace: override ?? '—',
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
export const ellipsis = (override?: string) =>
|
|
144
|
+
textInputRule({
|
|
145
|
+
find: /\.\.\.$/,
|
|
146
|
+
replace: override ?? '…',
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
export const openDoubleQuote = (override?: string) =>
|
|
150
|
+
textInputRule({
|
|
151
|
+
find: /(?:^|[\s{[(<'"\u2018\u201C])(")$/,
|
|
152
|
+
replace: override ?? '“',
|
|
153
|
+
})
|
|
154
|
+
|
|
155
|
+
export const closeDoubleQuote = (override?: string) =>
|
|
156
|
+
textInputRule({
|
|
157
|
+
find: /"$/,
|
|
158
|
+
replace: override ?? '”',
|
|
159
|
+
})
|
|
160
|
+
|
|
161
|
+
export const openSingleQuote = (override?: string) =>
|
|
162
|
+
textInputRule({
|
|
163
|
+
find: /(?:^|[\s{[(<'"\u2018\u201C])(')$/,
|
|
164
|
+
replace: override ?? '‘',
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
export const closeSingleQuote = (override?: string) =>
|
|
168
|
+
textInputRule({
|
|
169
|
+
find: /'$/,
|
|
170
|
+
replace: override ?? '’',
|
|
171
|
+
})
|
|
172
|
+
|
|
173
|
+
export const leftArrow = (override?: string) =>
|
|
174
|
+
textInputRule({
|
|
175
|
+
find: /<-$/,
|
|
176
|
+
replace: override ?? '←',
|
|
177
|
+
})
|
|
178
|
+
|
|
179
|
+
export const rightArrow = (override?: string) =>
|
|
180
|
+
textInputRule({
|
|
181
|
+
find: /->$/,
|
|
182
|
+
replace: override ?? '→',
|
|
183
|
+
})
|
|
184
|
+
|
|
185
|
+
export const copyright = (override?: string) =>
|
|
186
|
+
textInputRule({
|
|
187
|
+
find: /\(c\)$/,
|
|
188
|
+
replace: override ?? '©',
|
|
189
|
+
})
|
|
190
|
+
|
|
191
|
+
export const trademark = (override?: string) =>
|
|
192
|
+
textInputRule({
|
|
193
|
+
find: /\(tm\)$/,
|
|
194
|
+
replace: override ?? '™',
|
|
195
|
+
})
|
|
196
|
+
|
|
197
|
+
export const servicemark = (override?: string) =>
|
|
198
|
+
textInputRule({
|
|
199
|
+
find: /\(sm\)$/,
|
|
200
|
+
replace: override ?? '℠',
|
|
201
|
+
})
|
|
202
|
+
|
|
203
|
+
export const registeredTrademark = (override?: string) =>
|
|
204
|
+
textInputRule({
|
|
205
|
+
find: /\(r\)$/,
|
|
206
|
+
replace: override ?? '®',
|
|
207
|
+
})
|
|
208
|
+
|
|
209
|
+
export const oneHalf = (override?: string) =>
|
|
210
|
+
textInputRule({
|
|
211
|
+
find: /(?:^|\s)(1\/2)\s$/,
|
|
212
|
+
replace: override ?? '½',
|
|
213
|
+
})
|
|
214
|
+
|
|
215
|
+
export const plusMinus = (override?: string) =>
|
|
216
|
+
textInputRule({
|
|
217
|
+
find: /\+\/-$/,
|
|
218
|
+
replace: override ?? '±',
|
|
219
|
+
})
|
|
220
|
+
|
|
221
|
+
export const notEqual = (override?: string) =>
|
|
222
|
+
textInputRule({
|
|
223
|
+
find: /!=$/,
|
|
224
|
+
replace: override ?? '≠',
|
|
225
|
+
})
|
|
226
|
+
|
|
227
|
+
export const laquo = (override?: string) =>
|
|
228
|
+
textInputRule({
|
|
229
|
+
find: /<<$/,
|
|
230
|
+
replace: override ?? '«',
|
|
231
|
+
})
|
|
232
|
+
|
|
233
|
+
export const raquo = (override?: string) =>
|
|
234
|
+
textInputRule({
|
|
235
|
+
find: />>$/,
|
|
236
|
+
replace: override ?? '»',
|
|
237
|
+
})
|
|
238
|
+
|
|
239
|
+
export const multiplication = (override?: string) =>
|
|
240
|
+
textInputRule({
|
|
241
|
+
find: /\d+\s?([*x])\s?\d+$/,
|
|
242
|
+
replace: override ?? '×',
|
|
243
|
+
})
|
|
244
|
+
|
|
245
|
+
export const superscriptTwo = (override?: string) =>
|
|
246
|
+
textInputRule({
|
|
247
|
+
find: /\^2$/,
|
|
248
|
+
replace: override ?? '²',
|
|
249
|
+
})
|
|
250
|
+
|
|
251
|
+
export const superscriptThree = (override?: string) =>
|
|
252
|
+
textInputRule({
|
|
253
|
+
find: /\^3$/,
|
|
254
|
+
replace: override ?? '³',
|
|
255
|
+
})
|
|
256
|
+
|
|
257
|
+
export const oneQuarter = (override?: string) =>
|
|
258
|
+
textInputRule({
|
|
259
|
+
find: /(?:^|\s)(1\/4)\s$/,
|
|
260
|
+
replace: override ?? '¼',
|
|
261
|
+
})
|
|
262
|
+
|
|
263
|
+
export const threeQuarters = (override?: string) =>
|
|
264
|
+
textInputRule({
|
|
265
|
+
find: /(?:^|\s)(3\/4)\s$/,
|
|
266
|
+
replace: override ?? '¾',
|
|
267
|
+
})
|
|
246
268
|
|
|
247
269
|
/**
|
|
248
270
|
* This extension allows you to add typography replacements for specific characters.
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,cAAc,iBAAiB,CAAA;AAE/B,eAAe,UAAU,CAAA"}
|