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

Function formatAttributes

src/formatter.ts:83–95  ·  view source on GitHub ↗
(n: Node)

Source from the content-addressed store, hash-verified

81}
82
83function* formatAttributes(n: Node) {
84 for (const [key, value] of Object.entries(n.attributes)) {
85 /**
86 * In cases where the class attribute is not a valid identifer, we treat it as a
87 * regular attribute without the '.' sigil
88 */
89 if (key === 'class' && typeof value === 'object' && !Ast.isAst(value))
90 for (const name of Object.keys(value)) {
91 yield formatAnnotationValue({ type: 'class', name, value });
92 }
93 else yield formatAnnotationValue({ type: 'attribute', name: key, value });
94 }
95}
96
97function* formatAnnotations(n: Node) {
98 if (n.annotations.length) {

Callers 1

formatNodeFunction · 0.85

Calls 1

formatAnnotationValueFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…