Skip to content

refactor(api-markdown-documenter): Remove DocumentationNodeType #24769

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

Josmithr
Copy link
Contributor

@Josmithr Josmithr commented Jun 4, 2025

The DocumentationNodeType enum has been removed.
Enumerations of supported node kinds in various contexts is now handled via type unions like BlockContent and PhrasingContent.
String literal types makes typing much simpler to reason about, and more inline with unist patterns.

@Josmithr Josmithr requested review from alexvy86, jumyhre, a team and Copilot June 4, 2025 23:42
@github-actions github-actions bot added public api change Changes to a public API base: main PRs targeted against main branch labels Jun 4, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes the DocumentationNodeType enum and replaces its usage with string literal types to simplify type definitions and align with unist patterns.

  • Removed all imports and references to DocumentationNodeType
  • Updated all node “type” properties to use the corresponding string literal values
  • Updated documentation and API reporting files to reflect these changes

Reviewed Changes

Copilot reviewed 31 out of 31 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tools/api-markdown-documenter/src/documentation-domain/OrderedListNode.ts Replaced DocumentationNodeType.OrderedList with "orderedList"
tools/api-markdown-documenter/src/documentation-domain/LinkNode.ts Replaced DocumentationNodeType.Link with "link"
tools/api-markdown-documenter/src/documentation-domain/LineBreakNode.ts Replaced DocumentationNodeType.LineBreak with "lineBreak"
tools/api-markdown-documenter/src/documentation-domain/HorizontalRuleNode.ts Replaced DocumentationNodeType.HorizontalRule with "horizontalRule"
tools/api-markdown-documenter/src/documentation-domain/HeadingNode.ts Replaced DocumentationNodeType.Heading with "heading"
tools/api-markdown-documenter/src/documentation-domain/FencedCodeBlockNode.ts Replaced DocumentationNodeType.FencedCode with "fencedCode"
tools/api-markdown-documenter/src/documentation-domain/DocumentationNodeType.ts Removed file as enum is no longer used
tools/api-markdown-documenter/src/documentation-domain/DocumentNode.ts Replaced DocumentationNodeType.Document with "document"
tools/api-markdown-documenter/src/documentation-domain/CodeSpanNode.ts Replaced DocumentationNodeType.CodeSpan with "codeSpan"
tools/api-markdown-documenter/src/documentation-domain/BlockQuoteNode.ts Replaced DocumentationNodeType.BlockQuote with "blockQuote"
tools/api-markdown-documenter/src/documentation-domain/BlockContent.ts Updated key names (e.g., blockQuote, fencedCode) in BlockContentMap
tools/api-markdown-documenter/src/documentation-domain-to-html/configuration/Transformation.ts Updated transformation mapping to use string literal types
tools/api-markdown-documenter/src/api-item-transforms/helpers/TableHelpers.ts Replaced DocumentationNodeType.Paragraph with "paragraph"
tools/api-markdown-documenter/src/api-item-transforms/helpers/Helpers.ts Replaced several DocumentationNodeType references with literal types
tools/api-markdown-documenter/src/api-item-transforms/TsdocNodeTransforms.ts Replaced several DocumentationNodeType references with literal types
tools/api-markdown-documenter/package.json Updated version from 0.20.0 to 0.21.0
tools/api-markdown-documenter/api-report/*.api.md Updated public API documentation to use new literal types
tools/api-markdown-documenter/CHANGELOG.md Documented the removal of DocumentationNodeType and version bump

@@ -34,7 +34,7 @@ import type { UnorderedListNode } from "./UnorderedListNode.js";
* @public
*/
export interface BlockContentMap {
fencedCodeBlock: FencedCodeBlockNode;
fencedCode: FencedCodeBlockNode;
Copy link
Contributor Author

@Josmithr Josmithr Jun 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for reviewers: This better aligns with FencedCodeBlock.type. These keys aren't actually used, so this change isn't strictly required, but aligning the keys with the node type properties seems ideal.

Copy link
Contributor

🔗 No broken links found! ✅

Your attention to detail is admirable.

linkcheck output


> fluid-framework-docs-site@0.0.0 ci:check-links /home/runner/work/FluidFramework/FluidFramework/docs
> start-server-and-test "npm run serve -- --no-open" 3000 check-links

1: starting server using command "npm run serve -- --no-open"
and when url "[ 'http://127.0.0.1:3000' ]" is responding with HTTP status code 200
running tests using command "npm run check-links"


> fluid-framework-docs-site@0.0.0 serve
> docusaurus serve --no-open

[SUCCESS] Serving "build" directory at: http://localhost:3000/

> fluid-framework-docs-site@0.0.0 check-links
> linkcheck http://localhost:3000 --skip-file skipped-urls.txt

Crawling...

Stats:
  222981 links
    1707 destination URLs
    1939 URLs ignored
       0 warnings
       0 errors


Copy link
Contributor

@RishhiB RishhiB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the unist pattern?

@Josmithr
Copy link
Contributor Author

what is the unist pattern?

unist is the underlying AST representation used by mdast, hast, etc. Our DocumentationNode types are derived from unist's base node definitions. The enum pattern is non-standard and not conducive to extensibility (they tend to imply a closed set of options, rather than an open-ended one). The various unist-based libraries just use raw strings as their types.

@Josmithr Josmithr merged commit c384b41 into microsoft:main Jun 10, 2025
31 checks passed
@Josmithr Josmithr deleted the api-markdown-documenter/remove-DocumentationNodeType branch June 10, 2025 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
base: main PRs targeted against main branch public api change Changes to a public API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants