-
Notifications
You must be signed in to change notification settings - Fork 362
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
adds update variable system to write vars to mdx #2001
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @douglance !
I'm blocking until we figure out a way to fix the issue with the "code" AST nodes and the ":" character.
|
||
return fileContent.replace( | ||
/@@\s*([a-zA-Z0-9_-]+)=([^@]+)@@/g, | ||
(match, varName, value) => globalVars[varName] || value.trim(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add a comment here (and maybe in the update-variable-references
too, but at least here), explaining that pages that are not modified are cached by Vercel and not updated, and that's why we follow this logic that seems like "duplication" (in the general case, we won't use the value that is in the content of the page, but the value that is in globalVars
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i improved comments in a few spots here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @douglance !
Approving to unblock, but please add the comment I mention in my latest message 🙏
update-variable-references.ts
file which can be run to update markdown files when globalVars.js changesmarkdown-preprocessor.js
that will swap out variables in markdown content before AST parsing happens@@
instead of@
for delimiting the bounds of our injected variables