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

Function serializeList

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

Source from the content-addressed store, hash-verified

268}
269
270const serializeList = (node: Element, ordered: boolean): string => {
271 const items = Array.from(node.children).filter(
272 (child) => child.tagName.toLowerCase() === 'li',
273 );
274
275 return items
276 .map((item, index) => {
277 const prefix = ordered ? `${index + 1}.` : '-';
278 const content = serializeInline(item).trim();
279 return `${prefix} ${content}`.trim();
280 })
281 .join('\n');
282};
283
284/**
285 * Converts HTML to markdown using basic markdown syntax.

Callers 1

htmlToMarkdownBasicFunction · 0.85

Calls 1

serializeInlineFunction · 0.85

Tested by

no test coverage detected