3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-20 15:15:44 +01:00

Answer the architecture review: emit-only spellings move down, and the tables drop markdown's words

This commit is contained in:
2026-08-27 22:37:11 +02:00
parent 430ef908c4
commit 44b2db3200
14 changed files with 125 additions and 82 deletions
+11
View File
@@ -1,5 +1,8 @@
export type LinePosition = 'first' | 'later'
const asciiPunctuation = /[!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~]/
const htmlConstructs = [/^<[!?]/, /^<\/?[A-Za-z][A-Za-z0-9-]*(?:[\s/>]|$)/, /^<[^\s<>@]+@[^\s<>@]+>/]
const controlCharacterRange = '\\u0000-\\u001f\\u007f'
const autolinkSource = `[A-Za-z][A-Za-z0-9+.-]{1,31}:[^\\s<>${controlCharacterRange}]*`
const nullCharacterSource = '\\u0000'
@@ -42,6 +45,10 @@ export function holdsNullCharacter(text: string): boolean {
return nullCharacter.test(text)
}
export function isAsciiPunctuation(character: string): boolean {
return asciiPunctuation.test(character)
}
export function isAutolink(text: string): boolean {
return autolink.test(text)
}
@@ -58,6 +65,10 @@ export function opensBracketedAutolink(text: string): boolean {
return bracketedAutolink.test(text)
}
export function opensHtmlConstruct(text: string): boolean {
return htmlConstructs.some((construct) => construct.test(text))
}
export function startsEntityReference(text: string): boolean {
return anchoredEntityReference.test(text)
}