Skip to content
Snippets Groups Projects
Commit 1a6f927b authored by marihachi's avatar marihachi
Browse files

wip

parent 9099f54b
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,72 @@ export function parsePlain(input: string): MfmNode[] {
return nodes;
}
function nodeStringify(node: MfmNode): string {
switch(node.type) {
// block
case 'quote': {
return toString(node.children).split('\n').map(line => `>${line}`).join('\n');
}
case 'search': {
break;
}
case 'blockCode': {
break;
}
case 'mathBlock': {
break;
}
case 'center': {
break;
}
// inline
case 'emoji': {
break;
}
case 'bold': {
break;
}
case 'small': {
break;
}
case 'italic': {
break;
}
case 'strike': {
break;
}
case 'inlineCode': {
break;
}
case 'mathInline': {
break;
}
case 'mention': {
break;
}
case 'hashtag': {
break;
}
case 'url': {
break;
}
case 'link': {
break;
}
case 'fn': {
break;
}
case 'text': {
return node.props.text;
}
}
return '';
}
export function toString(nodes: MfmNode[]): string {
return nodes.map(node => nodeStringify(node)).join('');
}
export {
MfmNode,
MfmBlock,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment