Skip to content

build(docs): Update api-markdown-documenter to 0.21.0 #25072

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

Open
wants to merge 153 commits into
base: main
Choose a base branch
from

Conversation

Josmithr
Copy link
Contributor

@Josmithr Josmithr commented Jul 22, 2025

Updates the dependency on @fluid-tools/api-markdown-documenter to 0.21.0 and updates the docs build infra to accommodate / leverage API changes.

Most notably: custom Markdown rendering is replaced with custom transformations from the library's "Documentation domain" to mdast (which is then rendered by mdast-util-to-markdown.

Josmithr added a commit that referenced this pull request Jul 23, 2025
…sformation (#24787)

Updates the library with a new transformation layer that converts the
`DocumentationNode` representation to
[mdast](https://github.com/syntax-tree/mdast), and replaces the
library's custom Markdown rendering with
[mdast-util-to-markdown](https://github.com/syntax-tree/mdast-util-to-markdown).

For an example of how the website build will be updated in response to
these changes, see here:
#25072.
MarioJGMsoft pushed a commit to MarioJGMsoft/FluidFramework that referenced this pull request Jul 28, 2025
…sformation (microsoft#24787)

Updates the library with a new transformation layer that converts the
`DocumentationNode` representation to
[mdast](https://github.com/syntax-tree/mdast), and replaces the
library's custom Markdown rendering with
[mdast-util-to-markdown](https://github.com/syntax-tree/mdast-util-to-markdown).

For an example of how the website build will be updated in response to
these changes, see here:
microsoft#25072.
@github-actions github-actions bot removed the public api change Changes to a public API label Jul 29, 2025
@Josmithr Josmithr requested review from alexvy86 and a team July 29, 2025 18:04
@Josmithr Josmithr changed the title [DRAFT] build(docs): Update api-markdown-documenter build(docs): Update api-markdown-documenter to 0.21.0 Jul 29, 2025
@Josmithr Josmithr marked this pull request as ready for review July 29, 2025 18:05
@Copilot Copilot AI review requested due to automatic review settings July 29, 2025 18:05
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 updates the dependency on @fluid-tools/api-markdown-documenter to version 0.21.0 and refactors the documentation build infrastructure to use the library's new API changes.

  • Updates dependency from 0.20.0 to 0.21.0 and adds required new dependencies
  • Replaces custom Markdown rendering with custom transformations from Documentation domain to mdast
  • Migrates from deprecated renderer-based approach to new transformation-based approach

Reviewed Changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
docs/package.json Updates API markdown documenter dependency and adds new required type definitions
docs/infra/api-markdown-documenter/render-api-documentation.mjs Migrates from custom renderers to custom transformations API
docs/infra/api-markdown-documenter/custom-transformations.mjs New file implementing transformations for admonition and table nodes
docs/infra/api-markdown-documenter/custom-renderers.mjs Removed file containing deprecated renderer implementations
docs/infra/api-markdown-documenter/api-documentation-layout.mjs Updates node construction to use new API patterns
docs/infra/api-markdown-documenter/admonition-node.mjs Adds new toMarkdown method and updates type system
Files not reviewed (1)
  • docs/pnpm-lock.yaml: Language not supported

@@ -28,9 +28,9 @@ import { AdmonitionNode } from "./admonition-node.mjs";
const customExamplesSectionTitle = "Usage";
const customThrowsSectionTitle = "Error Handling";

const supportDocsLinkSpan = new SpanNode([
const supportDocsLinkParagraph = new ParagraphNode([
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note for reviewers: Directives in mdast require block content children. All of the spans here have been updated to be paragraphs.

@@ -305,7 +304,7 @@ function createDeprecationNoticeSection(apiItem, config) {

return new AdmonitionNode(
transformedDeprecatedBlockContents,
"Warning",
"warning",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note for reviewers: this was technically a bug. We were implicitly working around it by converting the string to lower case in rendering.

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:
  232061 links
    1712 destination URLs
    1942 URLs ignored
       0 warnings
       0 errors


* @param {string | undefined} title - (Optional) Title text for the admonition.
*/
constructor(children, admonitionKind, title) {
super(children);

this.type = admonitionNodeType;
this.type = "admonition";
Copy link
Contributor

Choose a reason for hiding this comment

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

Admonition -> admonition is expected? Maybe similar to the Warning -> warning in another file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah. It's mostly an arbitrary change (the only thing that matters is that the corresponding transformation be registered with the same key), but camelCase is more in line with mdast standard practice than PascalCase.

throw new Error("Expected an HTML element as output from table node transformation.");
}

htmlTree.properties.class = "table table-striped table-hover";
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the classes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is existing behavior, just ported to the mdast layer instead of via custom HTML rendering. This is how we currently apply the desired styling to our generated tables. Or am I misunderstanding the question?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, I missed that they were already there in the deleted file. My bad :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: website base: main PRs targeted against main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants