mirror of
https://github.com/larvit/adf-codec.git
synced 2026-11-19 06:35:44 +01:00
Answer architecture round 1: 2 🔴, 5 🟡; nesting counts the JSON fallback alone, one mark attrs read and spell, one mark table, a malformed mark is unsupported-node-shape, the old colwidth names the comma list, README and notes name the attrs fallback
This commit is contained in:
@@ -21,14 +21,10 @@ export const markAttributes = {
|
||||
underline: {},
|
||||
} satisfies Readonly<Record<string, AttributeVocabulary>>
|
||||
|
||||
const blockMarkVocabularies: ReadonlyMap<string, AttributeVocabulary> = new Map(Object.entries(blockMarkAttributes))
|
||||
export const markVocabularies: ReadonlyMap<string, AttributeVocabulary> = new Map([...Object.entries(blockMarkAttributes), ...Object.entries(markAttributes)])
|
||||
|
||||
export type MarkType = keyof typeof markAttributes
|
||||
|
||||
export function isMarkType(type: string): type is MarkType {
|
||||
return Object.hasOwn(markAttributes, type)
|
||||
}
|
||||
|
||||
export function markVocabulary(type: string): AttributeVocabulary | undefined {
|
||||
return isMarkType(type) ? markAttributes[type] : blockMarkVocabularies.get(type)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user