mirror of
https://github.com/bendtherules/react-to-markdown.git
synced 2026-08-18 22:03:20 +00:00
tagHandler - Handle list and listitems
This commit is contained in:
+14
-1
@@ -1,4 +1,4 @@
|
||||
import { emphasis, heading, strong } from 'mdast-builder';
|
||||
import { emphasis, heading, strong, list, listItem } from 'mdast-builder';
|
||||
// tslint:disable-next-line: no-implicit-dependencies
|
||||
import { Node as MDASTNode, Parent as MDASTParent } from 'unist';
|
||||
import { IReactElementSubset } from './helpers';
|
||||
@@ -40,6 +40,19 @@ export default function handleTag(
|
||||
break;
|
||||
// END - Handle strong and em
|
||||
|
||||
// START - Handle lists - ul, ol, li
|
||||
case 'ul':
|
||||
newParentASTNode = childASTNode = list('unordered', []);
|
||||
break;
|
||||
case 'ol':
|
||||
newParentASTNode = childASTNode = list('ordered', []);
|
||||
break;
|
||||
case 'li':
|
||||
newParentASTNode = childASTNode = listItem([]);
|
||||
break;
|
||||
|
||||
// END - Handle lists - ul, ol, li
|
||||
|
||||
default:
|
||||
newParentASTNode = parentASTNode;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user