-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentity-map.ts
More file actions
46 lines (45 loc) · 2.48 KB
/
entity-map.ts
File metadata and controls
46 lines (45 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Browsers remap €–Ÿ to Windows-1252 equivalents rather than treating
// them as Unicode code points. Match that behaviour for real-world HTML.
// oxfmt-ignore
export const LEGACY_NUMERIC: Record<number, number> = {
0x80: 0x20AC, 0x82: 0x201A, 0x83: 0x0192, 0x84: 0x201E, 0x85: 0x2026,
0x86: 0x2020, 0x87: 0x2021, 0x88: 0x02C6, 0x89: 0x2030, 0x8A: 0x0160,
0x8B: 0x2039, 0x8C: 0x0152, 0x8E: 0x017D, 0x91: 0x2018, 0x92: 0x2019,
0x93: 0x201C, 0x94: 0x201D, 0x95: 0x2022, 0x96: 0x2013, 0x97: 0x2014,
0x98: 0x02DC, 0x99: 0x2122, 0x9A: 0x0161, 0x9B: 0x203A, 0x9C: 0x0153,
0x9E: 0x017E, 0x9F: 0x0178,
}
// Minimal set of "most common" entities
// oxfmt-ignore
export const NAMED_ENTITIES: Record<string, string> = {
// Essential — must always be present
amp: '&', lt: '<', gt: '>', quot: '"', apos: "'",
// Whitespace / invisible
nbsp: '\u00A0', ensp: '\u2002', emsp: '\u2003', thinsp: '\u2009',
zwnj: '\u200C', zwj: '\u200D',
// Punctuation
mdash: '—', ndash: '–', hellip: '…', laquo: '«', raquo: '»',
lsquo: '\u2018', rsquo: '\u2019', ldquo: '\u201C', rdquo: '\u201D',
bull: '•', middot: '·', shy: '\u00AD', prime: '′', Prime: '″',
// Symbols
copy: '©', reg: '®', trade: '™', deg: '°', plusmn: '±', micro: 'µ',
para: '¶', sect: '§', euro: '€', pound: '£', yen: '¥', cent: '¢',
// Math
times: '×', divide: '÷', frac12: '½', frac14: '¼', frac34: '¾',
sup2: '²', sup3: '³', infin: '∞', sum: '∑', radic: '√', minus: '−',
// Arrows
larr: '←', rarr: '→', uarr: '↑', darr: '↓', harr: '↔',
lArr: '⇐', rArr: '⇒', hArr: '⇔',
// Latin extended (common in Western European content)
agrave: 'à', aacute: 'á', acirc: 'â', atilde: 'ã', auml: 'ä', aring: 'å',
aelig: 'æ', ccedil: 'ç', egrave: 'è', eacute: 'é', ecirc: 'ê', euml: 'ë',
igrave: 'ì', iacute: 'í', icirc: 'î', iuml: 'ï', eth: 'ð', ntilde: 'ñ',
ograve: 'ò', oacute: 'ó', ocirc: 'ô', otilde: 'õ', ouml: 'ö', oslash: 'ø',
ugrave: 'ù', uacute: 'ú', ucirc: 'û', uuml: 'ü', yacute: 'ý', thorn: 'þ',
yuml: 'ÿ', szlig: 'ß',
Agrave: 'À', Aacute: 'Á', Acirc: 'Â', Atilde: 'Ã', Auml: 'Ä', Aring: 'Å',
AElig: 'Æ', Ccedil: 'Ç', Egrave: 'È', Eacute: 'É', Ecirc: 'Ê', Euml: 'Ë',
Igrave: 'Ì', Iacute: 'Í', Icirc: 'Î', Iuml: 'Ï', ETH: 'Ð', Ntilde: 'Ñ',
Ograve: 'Ò', Oacute: 'Ó', Ocirc: 'Ô', Otilde: 'Õ', Ouml: 'Ö', Oslash: 'Ø',
Ugrave: 'Ù', Uacute: 'Ú', Ucirc: 'Û', Uuml: 'Ü', Yacute: 'Ý', THORN: 'Þ',
}