Repository navigation
Conversation
Builders, element/ and the template helpers build and read nodes through mdast/'s functions instead of writing node objects by hand, so tree code stays in one folder. The mdast augmentations move to a file nothing imports, so the public types can't reach them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Builders,
element/and the template helpers now build and read Markdown nodes through functions inmdast/, such asstrongNode(children), instead of writing node objects by hand. This is one step toward keeping all tree code in that one folder.Waits on the parser move: the build fails until the parser is in
mdast/. Other layers now name node types frommdast/index.ts, so the public type bundle reaches the folder's declarations:htmlEntityFromMarkdownfortemplate/parse.ts.mdast-util-from-markdown, whose own types augmentmicromark-util-types.Once the parser is in
mdast/, the extension is private to the folder, and the build passes. A local trial confirmed this:dist/index.d.tscame out as onmain.Node constructors and readers (
mdast/nodes.ts)paragraphNode,headingNode,listNodeandtableNode.listNodenumbers the list when given astart.listItemNodemakes a task when givenchecked.tableNodetakes the content of each cell, row by row.frontmatterOf,withoutFrontmatterandparagraphContent.RootContentthrough the folder's index, not frommdast.Node helpers moved into the folder
textNodes,stringNodesandjoinLinesgo tomdast/text.ts, andinListstomdast/lists.ts.isFormattingmoves fromblanks.tstonodes.ts.The mdast augmentations, in one file that nothing imports
The four
declare module 'mdast'blocks move tomdast/customNodes.ts. In declaration files they're side effects, so a type import from the folder pulled them, and all of@types/mdast, into the public types. In a file with no importers, they apply only when the package's own source is type-checked.Layer test
src/layers.test.tsfails when a file outsidemdast/imports a tree package:mdast,remark-*,unified,unist-*,micromark*ormdast-util-*. It lists the five files that still do, and the next steps empty that list.