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

Add hook and API to transform tokens individually before rendering #94

Open
NathanLovato opened this issue Jan 18, 2025 · 0 comments
Open

Comments

@NathanLovato
Copy link
Contributor

When parsing MDX documents, add a way to walk or retrieve tokens and call procedures to process them:

  • Markdown image tags need to be converted into a PublicImage component with class names so there needs to be a way to create a new components, and replace a component with the new object
  • Inline code sometimes need to be replaced with <IconGodot ...> components
  • Video files need file paths to be make absolute
  • Include components need to be replaced with the included and preprocessed content

For these tasks, the API should allow:

  1. Looping over tokens
  2. Editing tokens
  3. Creating new tokens
  4. Inserting tokens
  5. Replacing tokens

For includes and special case, we can think of a simple token that contains text that gets inserted as-is? Preserving the original token indentation optionally

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

No branches or pull requests

1 participant