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

Syntax lookup dynamic include #170

Merged
merged 4 commits into from
Jan 5, 2021
Merged

Syntax lookup dynamic include #170

merged 4 commits into from
Jan 5, 2021

Conversation

kevanstannard
Copy link
Contributor

@kevanstannard kevanstannard commented Jan 5, 2021

Suggestion for dynamically importing the syntax files for #162

Usage is as follows:

[1] Write a new syntax mdx file.
[2] Run the extract-syntax.js script to generate a syntax index json file.
[3] The SyntaxLookupWidget will then read the index file and include on the page.

Just sharing what I have so far and see what you think.

image

Edit 1: I see the Vercel check has failed. I'm not sure what that problem might be.
Edit 2: Looks like adding extract-syntax to the update-index script fixed it.

@ryyppy
Copy link
Member

ryyppy commented Jan 5, 2021

Right, so you solved one part, which is extracting the meta data back for the UI so it can do the search stuff.

My concern was more about the resulting bundle coming from the mdx component files (the help text for each syntax construct).

My initial idea was to use getStaticProps and try something like mdx-remote to server side render the resulting markdown texts as plain strings, and later on insert them in the react tree with __dangerouslySetInnerHtml or so.

This change was definitely necessary anyways, so I will take it for now as is.

Thanks

EDIT: Ah and good job on finding yourself through the code. Really nice and readable diffs.

@ryyppy ryyppy merged commit c5551ab into rescript-lang:syntax-lookup-tool Jan 5, 2021
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.

2 participants