3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-12 11:48:29 +01:00
Files
adf-codec/src/html/mark-elements.ts
T

16 lines
491 B
TypeScript

// The element each mark but a link writes around text, holding no attribute; a link writes `<a>`.
const markElements: ReadonlyMap<string, string> = new Map([
['code', 'code'],
['em', 'em'],
['strong', 'strong'],
])
export function elementOfMark(type: string): string | undefined {
return markElements.get(type)
}
export function markOfElement(name: string): string | undefined {
for (const [type, element] of markElements) if (element === name) return type
return undefined
}