MCPcopy Create free account
hub / github.com/dailydotdev/apps / serializeList

Function serializeList

packages/shared/src/lib/markdownConversion.ts:299–311  ·  view source on GitHub ↗
(node: Element, ordered: boolean)

Source from the content-addressed store, hash-verified

297}
298
299const serializeList = (node: Element, ordered: boolean): string => {
300 const items = Array.from(node.children).filter(
301 (child) => child.tagName.toLowerCase() === 'li',
302 );
303
304 return items
305 .map((item, index) => {
306 const prefix = ordered ? `${index + 1}.` : '-';
307 const content = serializeInline(item).trim();
308 return `${prefix} ${content}`.trim();
309 })
310 .join('\n');
311};
312
313/**
314 * Converts HTML to markdown using basic markdown syntax.

Callers 1

htmlToMarkdownBasicFunction · 0.85

Calls 1

serializeInlineFunction · 0.85

Tested by

no test coverage detected