Normalize grammarNumber
MODIFY
packages/@romejs/string-markup/format.ts
packages/@romejs/string-markup/format.ts
@@ -260,11 +260,19 @@ export function normalizeMarkup(
return escapeMarkup(text);
},
formatTag: (tag, attributes, value) => {
- // Normalize filename of <filelink target>
- if (tag === 'filelink') {
+ switch (tag) {
+ case // Normalize filename of <filelink target>
+ 'filelink': {
const {text, filename} = formatFileLink(attributes, value, opts);
attributes.set('target', filename);
value = text;
+ break;
+ }
+
+ // We don't technically need to normalize this but it's one less tag to have to support
+ // if other tools need to consume it
+ case 'grammarNumber':
+ return formatGrammarNumber(attributes, value);
}
let attrStr = Array.from(attributes, ([key, value]) => {

MODIFY
packages/@romejs/string-markup/parse.ts
packages/@romejs/string-markup/parse.ts
@@ -157,7 +157,11 @@ const createStringMarkupParser = createParser(
const end = add(stringValueEnd, 1);
return {
state,
- token: this.finishValueToken('String', value, end),
+ token: this.finishValueToken(
+ 'String',
+ unescapeTextValue(value),
+ end,
+ ),
};
}

Normalize grammarNumber