feat(mdxish): resolve variables in code blocks#1350
Merged
kevinports merged 31 commits intonextfrom Feb 20, 2026
Merged
Conversation
…dimas/RM-15239-parse-legacy-vars-in-mdxish
commit e657a21 Author: eagletrhost <dimazanugrah12@gmail.com> Date: Mon Feb 16 19:51:12 2026 +1100 refactor: clean code & comment commit c28853d Author: eagletrhost <dimazanugrah12@gmail.com> Date: Mon Feb 16 19:40:18 2026 +1100 test: fix legacy commit 7574b19 Author: eagletrhost <dimazanugrah12@gmail.com> Date: Mon Feb 16 18:36:04 2026 +1100 feat: glossary adjustments commit 6e92df0 Author: eagletrhost <dimazanugrah12@gmail.com> Date: Mon Feb 16 18:13:02 2026 +1100 feat: parse legacy vars in codes & api header block
kevinports
reviewed
Feb 19, 2026
Contributor
kevinports
left a comment
There was a problem hiding this comment.
Looks good overall. Just had a question regarding the transformer placement in the pipeline.
lib/mdxish.ts
Outdated
| .use(mdxishHtmlBlocks) | ||
| .use(newEditorTypes ? mdxishJsxToMdast : undefined) // Convert JSX elements to MDAST types | ||
| .use(safeMode ? undefined : evaluateExpressions, { context: jsxContext }) // Evaluate MDX expressions using jsxContext | ||
| .use(variablesCodeTransformer, { variables }) // Resolve <<...>> and {user.*} inside code and inline code nodes |
Contributor
There was a problem hiding this comment.
Why does this need to happen in mdxishAstProcessor?
The mdxish pipeline handles "rendering" and we only need to resolve vars at that time. So could we put it in mdxish and avoid having to have an arg in mdxishAstProcessor for this?
We'll want to keep these unresolved in mdxishAstProcessor for the editor.
Contributor
Author
There was a problem hiding this comment.
That makes better sense yeah
| ); | ||
| } | ||
|
|
||
| const variablesCodeTransformer: Plugin<[Options?]> = ({ variables }: Options = {}) => tree => { |
Contributor
There was a problem hiding this comment.
A JSDoc describing what this transformer is and why need it might be helpful here.
Contributor
Author
|
One sec a test failing Update: Done! |
kevinports
approved these changes
Feb 20, 2026
rafegoldberg
pushed a commit
that referenced
this pull request
Feb 20, 2026
## Version 13.3.0 ### ✨ New & Improved * **mdxish:** add legacy variable tokenizer ([#1339](#1339)) ([8e8b11b](8e8b11b)) * add option to perserve variable syntax in plain text compiler ([#1345](#1345)) ([5ab350e](5ab350e)) * **mdxish:** resolve variables in code blocks ([#1350](#1350)) ([a6460f8](a6460f8)) * **mdxish:** use variable name for heading slug generation ([#1340](#1340)) ([61a97d3](61a97d3)) <!--SKIP CI-->
Contributor
This PR was released!🚀 Changes included in v13.3.0 |
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.

🧰 Changes
As a follow up of #1339, we want to resolve variables in inline code & code blocks, and the tokenizer couldn't do that. This PR adds an additional argument to the engine for the project variables, and a transformer to visit code nodes & use regexes to resolve legacy & MDX variables to their value.
🧬 QA & Testing
The variables in this should get resolved, test with code blocks