MCPcopy
hub / github.com/dvanoni/notero / convertRichTextNode

Function convertRichTextNode

src/content/sync/html-to-notion/html-to-notion.ts:232–261  ·  view source on GitHub ↗
(
  node: ParsedNode,
  options: RichTextOptions,
)

Source from the content-addressed store, hash-verified

230}
231
232function convertRichTextNode(
233 node: ParsedNode,
234 options: RichTextOptions,
235): RichText {
236 if (node.type === 'text') {
237 return buildRichText(node.textContent, options);
238 }
239
240 if (node.type === 'br') {
241 return buildRichText('\n', { ...options, preserveWhitespace: true });
242 }
243
244 if (node.type === 'inline_math') {
245 return [{ equation: { expression: node.expression } }];
246 }
247
248 const updatedOptions = { ...options };
249
250 if (node.type === 'rich_text') {
251 updatedOptions.annotations = {
252 ...options.annotations,
253 ...node.annotations,
254 };
255 if (node.link) {
256 updatedOptions.link = node.link;
257 }
258 }
259
260 return convertRichTextChildNodes(node.element, updatedOptions);
261}
262
263function paragraphBlock(richText: RichText): ParagraphBlock {
264 return { paragraph: { rich_text: richText } };

Callers 2

convertNodeFunction · 0.85

Calls 2

buildRichTextFunction · 0.90

Tested by

no test coverage detected