Skip to content
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

Merged
merged 15 commits into from
Jan 31, 2025
Merged

Conversation

douglance
Copy link
Contributor

@douglance douglance commented Jan 24, 2025

  • adds update-variable-references.ts file which can be run to update markdown files when globalVars.js changes
  • swaps to using a function in markdown-preprocessor.js that will swap out variables in markdown content before AST parsing happens
  • swaps to using @@ instead of @ for delimiting the bounds of our injected variables

@douglance douglance requested a review from TucksonDev January 24, 2025 15:10
Copy link

vercel bot commented Jan 24, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
arbitrum-docs ✅ Ready (Inspect) Visit Preview Jan 31, 2025 2:12pm

Copy link
Contributor

@TucksonDev TucksonDev left a 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.

website/src/remark/variable-injector.js Outdated Show resolved Hide resolved
website/tsconfig.json Show resolved Hide resolved

return fileContent.replace(
/@@\s*([a-zA-Z0-9_-]+)=([^@]+)@@/g,
(match, varName, value) => globalVars[varName] || value.trim(),
Copy link
Contributor

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).

Copy link
Contributor Author

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

Copy link
Contributor

@TucksonDev TucksonDev left a 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 🙏

@pete-vielhaber pete-vielhaber merged commit a2031b9 into master Jan 31, 2025
4 checks passed
@pete-vielhaber pete-vielhaber deleted the dl/var-inject branch January 31, 2025 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants