MCPcopy Index your code
hub / github.com/markdoc/markdoc / formatAnnotationValue

Function formatAnnotationValue

src/formatter.ts:71–81  ·  view source on GitHub ↗
(a: AttributeValue)

Source from the content-addressed store, hash-verified

69}
70
71function formatAnnotationValue(a: AttributeValue): string | undefined {
72 const formattedValue = formatScalar(a.value);
73
74 if (formattedValue === undefined) return undefined;
75 if (a.name === 'primary') return formattedValue;
76 if (a.name === 'id' && typeof a.value === 'string' && isIdentifier(a.value))
77 return '#' + a.value;
78 if (a.type === 'class' && isIdentifier(a.name)) return '.' + a.name;
79
80 return `${a.name}=${formattedValue}`;
81}
82
83function* formatAttributes(n: Node) {
84 for (const [key, value] of Object.entries(n.attributes)) {

Callers 1

formatAttributesFunction · 0.85

Calls 2

isIdentifierFunction · 0.90
formatScalarFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…