Skip to content

refactor(markdown-magic): Replatform onto remark/mdast - #28098

Merged
Joshua Smithrud (Josmithr) merged 53 commits into
microsoft:mainfrom
Josmithr:markdown-magic/replatform-onto-remark
Sep 9, 2026
Merged

refactor(markdown-magic): Replatform onto remark/mdast#28098
Joshua Smithrud (Josmithr) merged 53 commits into
microsoft:mainfrom
Josmithr:markdown-magic/replatform-onto-remark

Conversation

@Josmithr

@Josmithr Joshua Smithrud (Josmithr) commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

This pattern unlocks a lot more flexibility in how we do generation / content copying. New functionality included in this PR:

  • Support for .mdx files (like we use in the website)
  • Automatic heading level detection when creating contents that include headings.

Future improvements that will be possible:

  • Automatic file path link re-mapping (so you can safely embed contents that include links).

Also updates the code to use TypeScript.

@github-actions github-actions Bot added area: tools area: build Build related issues area: repo Repo related work dependencies Pull requests that update a dependency file area: website base: main PRs targeted against main branch labels Aug 27, 2026
Comment thread tools/markdown-magic/REMARK_REPLATFORMING_DESIGN.md Outdated
@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Hi! Thank you for opening this PR. Want me to review it?

Based on the diff (21305 lines, 263 files), I've queued these reviewers:

  • Correctness — logic errors, race conditions, lifecycle issues
  • Security — vulnerabilities, secret exposure, injection
  • API Compatibility — breaking changes, release tags, type design
  • Performance — algorithmic regressions, memory leaks
  • Testing — coverage gaps, hollow tests

How this works

  • Adjust the reviewer set by ticking/unticking boxes above. Reviewer toggles alone don't trigger anything.

  • Tick Start review below to dispatch the review fleet.

  • After review finishes, tick Start review again to request another run — it auto-resets after each dispatch.

  • This comment updates as new commits land; your reviewer selections are preserved.

  • Start review

Comment thread tools/markdown-magic/README.md Outdated
Comment thread tools/markdown-magic/docs/transforms/api-docs.md
@@ -0,0 +1,149 @@
/*!

@Josmithr Joshua Smithrud (Josmithr) Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

TODO: remove this before we merge the PR

Comment thread tools/markdown-magic/src/processing.ts Outdated
Comment thread tools/markdown-magic/src/processing.ts Outdated
Comment thread tools/markdown-magic/src/processing.ts Outdated
Comment thread tools/markdown-magic/src/transformRegistry.ts Outdated
Comment thread tools/markdown-magic/src/transforms.ts Outdated
Comment thread tools/markdown-magic/src/transforms.ts Outdated
Comment thread tools/markdown-magic/src/types.ts
Comment thread tools/markdown-magic/test/cli.test.ts
The Azure local service includes most of the basic features needed to **test** data stores and containers. While we use the [Webpack Fluid Loader](../../packages/tools/webpack-fluid-loader)'s in browser service for much of our data store and container development, the Azure local service offers some advantages because it's a standalone process. For instance, testing a Fluid container from 2+ simultaneously connected clients is much easier using the Azure local service.

<!-- AUTO-GENERATED-CONTENT:START (LIBRARY_README_HEADER) -->
<!-- markdown-magic:begin {"transform":"library-readme-header","headingLevel":2} -->

Copy link
Copy Markdown
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: the syntax for our transforms has changed. A key benefit to the new syntax is that it supports JSON for the options.


- The configuration works but needs official support.
- The configuration does not work and requires changes.
* The configuration works but needs official support.

Copy link
Copy Markdown
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: the Markdown formatting used by ReMark is different from what we were previously hard-coding. There should be no end-reader-visible changes made here, but the PR does include a lot of formatting changes. There wasn't a practical way to prevent this :/

Comment thread website/README.md
@@ -386,51 +386,92 @@ import { YoutubeVideo } from "@site/src/components/youtubeVideo";

The following npm scripts are supported in this directory:

<!-- AUTO-GENERATED-CONTENT:START (PACKAGE_SCRIPTS:includeHeading=FALSE) -->
<!-- markdown-magic:begin {

@Josmithr Joshua Smithrud (Josmithr) Sep 9, 2026

Copy link
Copy Markdown
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: there wasn't a great way to implement this package scripts functionality in the new model without needing to declare all of the relevant scripts up-front. That said, the existing behavior was VERY error-prone, and the new behavior is much more robust. In particular, if a referenced script is removed from the package.json, the docs build will error if that script is still mentioned here, which is quite useful.

But all-in-all, I'm on the fence about this. It's strictly opt-in, so READMEs don't need to do this. But I also question how valuable this content really is.

I'm interested in others' opinions :)

@@ -1,306 +0,0 @@
---

Copy link
Copy Markdown
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: I guess the changes here were substantial enough that git doesn't see this as a rename. But this file wasn't removed. It's just now a .mdx file.

Comment thread tools/markdown-magic/src/transforms/packageScripts.ts Outdated
Comment thread tools/markdown-magic/src/processorProfiles.ts Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A few comments below. Otherwise overall lgtm. I did not look in detail at all the src/test files, and I only skimmed the docs/transforms/ files, but the idea looks correct and the implementation seems to be working as intended. Since stakes are relatively low, I think less nitpicky reviews and quick iteration is where this code wants to be, so approving anyway.

Comment on lines -39 to -41
"dependencyComments": [
"chalk is left at version 4 (not 5) to keep CommonJS support."
],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If we're making markdown-magic an ESM module, can we bump the chalk version now?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch! I think so!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It looks like at least one other package in the client workspace is using the older version too. I'll do this update as a separate PR.

Comment thread tools/markdown-magic/package.json Outdated
@alexvy86

Copy link
Copy Markdown
Contributor

[Agent-generated]

Summary of a deep review of commit 954cce44497ac96e7a131f18c69b60d63dbb244a, scoped to markdown-magic, its tests/configuration, and representative generated docs and MDX integration.

Recommendation: address these three reproduced correctness issues before merging. These are generator edge cases, not failures observed in the checked-in website.

  1. Included generation markers break subsequent runs (processing.ts:119-120). Including a source containing a valid help region succeeds, but writes nested markers into the destination. The next run throws Generated regions must not nest. Validate generated-region structure in the complete proposed output before writing, preserving the original file on failure.

  2. Reference definitions can leak beyond the selected line range (include.ts:268-275). When start: 0, end: 2 selects an opening code fence and its first content line, appended reference definitions are absorbed into the open code block and emitted, even though they are outside the requested range. Keep reference-definition context separate from constructs in the selected text and add a regression for this case.

  3. Duplicate reference definitions resolve to the wrong URL (include.ts:250-254). A source containing [x][r] followed by definitions for https://first.example and https://second.example generates a link to the second URL. new Map(...) makes the last definition win, contrary to CommonMark's first-definition-wins rule. Retain the first definition for each normalized identifier and cover duplicate labels in tests.

The remaining repository-wide README churn and lockfile contents were not reviewed line by line.

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Bundle size comparison

Base commit: 2918565f70f4e3b8477ee2f14055c44325670869
Head commit: bb80e9181fe967eadab71c3df1a9f19daf9c8693

Pending — Build - client packages is running. Results will appear here when the build completes.

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

🔗 No broken links found! ✅

Your attention to detail is admirable.

linkcheck output

$ start-server-and-test "npm run serve -- --host 127.0.0.1 --no-open" http://127.0.0.1:3000 check-links
1: starting server using command "npm run serve -- --host 127.0.0.1 --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-website@0.0.0 serve
> docusaurus serve --host 127.0.0.1 --no-open

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

> fluid-framework-website@0.0.0 check-links
> linkcheck http://127.0.0.1:3000 --skip-file skipped-urls.txt

Crawling...

Stats:
  351523 links
    2064 destination URLs
    2323 URLs ignored
       0 warnings
       0 errors


@Josmithr
Joshua Smithrud (Josmithr) merged commit 44e6a4c into microsoft:main Sep 9, 2026
60 checks passed
@Josmithr
Joshua Smithrud (Josmithr) deleted the markdown-magic/replatform-onto-remark branch September 9, 2026 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: build Build related issues area: dds: sharedstring area: dds: tree area: dds Issues related to distributed data structures area: dev experience Improving the experience of devs building on top of fluid area: driver Driver related issues area: examples Changes that focus on our examples area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct area: loader Loader related issues area: odsp-driver area: repo Repo related work area: runtime Runtime related issues area: server Server related issues (routerlicious) area: tests Tests to add, test infrastructure improvements, etc area: tools area: website base: main PRs targeted against main branch dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants