Skip to content

fix: preserve legacy syntax for legacy variables - #1365

Merged
HugoHSun merged 3 commits into
nextfrom
hugo/cx-98-search-variables
Feb 26, 2026
Merged

HugoHSun merged 3 commits into
nextfrom
hugo/cx-98-search-variables

Conversation

@HugoHSun

@HugoHSun HugoHSun commented Feb 26, 2026 •

Copy link
Copy Markdown
Member
PR App Fix CX-98

🧰 Changes

Since we can now distinguish legacy variable vs mdx variable (#1340), as well as allowing wild variables in bracket notation (https://github.com/readmeio/readme/pull/17315). We should add support for plain to keep original syntax as is, instead of serialising everything to {user.}.

🧬 QA & Testing

Unit tests

@HugoHSun
HugoHSun marked this pull request as ready for review February 26, 2026 09:25
@HugoHSun
HugoHSun enabled auto-merge (squash) February 26, 2026 09:25

@rafegoldberg rafegoldberg left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Double checked this regex; looks good to me.

Comment thread lib/plain.ts
const STRIP_TAGS = ['script', 'style'];

/** Valid JS identifier: starts with $, _, or a letter; followed by $, _, letters, digits, etc. */
const JS_IDENTIFIER_RE = /^[$_\p{L}][$_\p{L}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\u200C\u200D]*$/u;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Personally, but I'd rename this to VALID_IDENTIFIER_REGEX, since the "JS" part is kinda implied and "RE" doesn't immediately scan. But again, just nitpicking!

@HugoHSun
HugoHSun merged commit d735a99 into next Feb 26, 2026
20 of 23 checks passed
@HugoHSun
HugoHSun deleted the hugo/cx-98-search-variables branch February 26, 2026 15:51
rafegoldberg pushed a commit that referenced this pull request Feb 26, 2026
## Version 13.4.0
### ✨ New & Improved

* **mdxish:** preserve jsx expressions in ast processor ([#1332](#1332)) ([7704aaa](7704aaa))

### 🛠 Fixes & Updates

* focus on code copy button ([#1352](#1352)) ([6853be1](6853be1))
* **stripComments:** not escape checkbox ([#1360](#1360)) ([a4226c2](a4226c2))
* preserve legacy syntax for legacy variables ([#1365](#1365)) ([d735a99](d735a99))

<!--SKIP CI-->
@rafegoldberg

Copy link
Copy Markdown
Collaborator

This PR was released!

🚀 Changes included in v13.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants