All files / json-crdt-extensions/peritext/lazy export-markdown.ts

100% Statements 11/11
100% Branches 0/0
100% Functions 2/2
100% Lines 8/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 141x 1x 1x       1x 48x 48x 48x     24x  
import {toHast} from './export-html';
import {toMdast as _toMdast} from 'very-small-parser/lib/html/toMdast';
import {toText as _toMarkdown} from 'very-small-parser/lib/markdown/block/toText';
import type {IRoot} from 'very-small-parser/lib/markdown/block/types';
import type {PeritextMlNode} from '../block/types';
 
export const toMdast = (json: PeritextMlNode): IRoot => {
  const hast = toHast(json);
  const mdast = _toMdast(hast) as IRoot;
  return mdast;
};
 
export const toMarkdown = (json: PeritextMlNode): string => _toMarkdown(toMdast(json));