MCPcopy
hub / github.com/markmap/markmap / transform

Function transform

packages/markmap-lib/test/index.test.ts:159–173  ·  view source on GitHub ↗
(transformHooks)

Source from the content-addressed store, hash-verified

157 {
158 name: 'target-blank',
159 transform(transformHooks) {
160 transformHooks.parser.tap((md) => {
161 md.renderer.renderAttrs = wrapFunction(
162 md.renderer.renderAttrs,
163 (renderAttrs, token) => {
164 let attrs = renderAttrs(token);
165 if (token.type === 'link_open') {
166 attrs += ' target="_blank"';
167 }
168 return attrs;
169 },
170 );
171 });
172 return {};
173 },
174 },
175 ]);
176 const result = transformer.transform(`\

Callers

nothing calls this directly

Calls 2

wrapFunctionFunction · 0.90
tapMethod · 0.80

Tested by

no test coverage detected