-
Notifications
You must be signed in to change notification settings - Fork 537
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Refactor
api-markdown-documenter
to be written in terms of AS…
…Ts and functional transformations (#14201) ## BREAKING CHANGE This is a complete overhaul of the library, greatly changing its API surface. The general consumption patterns remain mostly the same, but the largely operate on our new AST types. ## New Architecture The old architecture was based on (and greatly re-used) the base API-Documenter library. This PR moves mostly away from this. Rather than operating on a flow that resembled something like: ``` ApiItem (w/ DocNode) -> DocNode -> stateful render ``` We now transform in input ApiItem tree (generated by API-Extractor) into an [AST](https://en.wikipedia.org/wiki/Abstract_syntax_tree)-based Documentation Domain. From there, we provide a more-functional rendering library for rendering that domain as Markdown. So something more like: ``` ApiItem -> Documentation Domain -> functional render ``` ### Benefits - Functional renderer is much easier to understand, easy to unit test (see the `RenderFoo` test modules), and made it easy to clean up a number of rendering inconsistencies hidden by the API-Documenter-based `MarkdownEmitter` renderer. - Intermediary Documentation Domain is easy to understand, `AST` compatible, and requires no auxiliary state to process (old DocNode domain required a tsdoc context to be able to walk, and also had to reach back into the ApiItem domain to resolve links, etc.). - Uses existing [unist](https://github.com/syntax-tree/unist) library for AST representation (with domain-specific type-safety). ## Notes for reviewers The actual code diff is probably not all that useful. Some of the configuration types will look roughly the same, but otherwise the majority of the code has been re-written. I would recommend referring to the README's architectural overview / changes to the prescribed workflow. Additionally, you can view the diffs in our rendering snapshot tests to confirm that behavioral changes are relatively small, and in my opinion, are all improvements. --------- Co-authored-by: Justin Myhres <[email protected]> Co-authored-by: Justin Myhres <[email protected]>
- Loading branch information
1 parent
1350ff5
commit c67c080
Showing
209 changed files
with
10,381 additions
and
4,895 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ | |
"pseudorandomly", | ||
"Tinylicious", | ||
"tombstoned", | ||
"TSDoc", | ||
"unaugmented" | ||
], | ||
|
||
|
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
nyc | ||
*.log | ||
**/*.tsbuildinfo | ||
src/test | ||
dist/test | ||
src/**/test | ||
dist/**/test | ||
**/_api-extractor-temp/** |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.