INNER CODE UNIT · TypeScript

CLOSING_HTML_TAG

vinta/pangu.js · src/shared/index.ts:230

export const CLOSING_HTML_TAG = /<\/([a-zA-Z][a-zA-Z0-9]*)/g;

export const CJK_HTML_TAG_MENTION = new RegExp(`([${CJK}])(?=\uE004)`, 'g');
export const HTML_TAG_MENTION_CJK = new RegExp(`(?<=\uE005)([${CJK}])`, 'g');

// A URL reads as one unit: nothing inside it is modified, and it is spaced from CJK on its left. Scheme-anchored only, and CJK characters continue the URL (/wiki/\u4e2d\u6587), so CJK
// prose written tight after a URL stays tight. The body ends at the Private Use Area too, so a URL never swallows a placeholder. See ADR 0026
export const HTTP_URL = /(?<![A-Za-z0-9])https?:\/\/[^\s<>"`\u3000-\u303f\uff00-\uffef\u2018\u2019\u201c\u201d\u2026\ue000-\uf8ff]+/g;
// Trailing half-width punctuation and an unbalanced closing parenthesis belong to the prose, not the URL
export const HTTP_URL_TRAILING_PUNCTUATION = /[.,;:!?'"]+$/;
export const CJK_HTTP_URL = new RegExp(`([${CJK}])(?=\uE00A)`, 'g');

// Used by fixBracketSpacing to strip the spaces just inside a bracket pair; everything else between the brackets stays unchanged
export const BRACKET_PATTERNS = [
  { pattern: /<([^<>]*)>/g, open: '<', close: '>' },
  { pattern: /\(([^()]*)\)/g, open: '(', close: ')' },
  { pattern: /\[([^\[\]]*)\]/g, open: '[', close: ']' },
  { pattern: /\{([^{}]*)\}/g, open: '{', close: '}' },

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…