Package Exports
- mdast-flatten-listitem-paragraphs
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mdast-flatten-listitem-paragraphs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
mdast-flatten-listitem-paragraphs
Transforms a markdown AST (MDAST) so that listItem nodes do not contain a paragraph node as child. Mutates the input AST.
Installation
npm install mdast-flatten-listitem-paragraphsUsage
// ...
var flattenListItemParagraphs = require('mdast-flatten-listitem-paragraphs');
unified()
.use(parse)
.use(flattenListItemParagraphs)
// ...Markdown document:
# Title
- First
- The **second** itemInput AST:
root[2] (1:1-6:1, 0-40)
├─ heading[1] (2:1-2:8, 1-8) [depth=1]
│ └─ text: "Title" (2:3-2:8, 3-8)
└─ list[2] (4:1-5:22, 10-39) [ordered=false][loose=false]
├─ listItem[1] (4:1-4:8, 10-17) [loose=false]
│ └─ paragraph[1] (4:3-4:8, 12-17)
│ └─ text: "First" (4:3-4:8, 12-17)
└─ listItem[1] (5:1-5:22, 18-39) [loose=false]
└─ paragraph[3] (5:3-5:22, 20-39)
├─ text: "The " (5:3-5:7, 20-24)
├─ strong[1] (5:7-5:17, 24-34)
│ └─ text: "second" (5:9-5:15, 26-32)
└─ text: " item" (5:17-5:22, 34-39)Output AST:
root[2] (1:1-6:1, 0-40)
├─ heading[1] (2:1-2:8, 1-8) [depth=1]
│ └─ text: "Title" (2:3-2:8, 3-8)
└─ list[2] (4:1-5:22, 10-39) [ordered=false][loose=false]
├─ listItem[1] (4:1-4:8, 10-17) [loose=false]
│ └─ text: "First" (4:3-4:8, 12-17)
└─ listItem[3] (5:1-5:22, 18-39) [loose=false]
├─ text: "The " (5:3-5:7, 20-24)
├─ strong[1] (5:7-5:17, 24-34)
│ └─ text: "second" (5:9-5:15, 26-32)
└─ text: " item" (5:17-5:22, 34-39)