-
Notifications
You must be signed in to change notification settings - Fork 12
feat(web): add web generator #285
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
base: main
Are you sure you want to change the base?
Conversation
❌ 2 Tests Failed:
View the top 2 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
const language = matches?.groups?.language ?? ''; | ||
const [copyText, setCopyText] = useState('Copy to clipboard'); | ||
|
||
const handleCopy = async text => { |
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.
Why not including useCopyToClipord in ui lib ?
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.
IIRC I didn't include it since it didn't fall under the "UI Component" category, it's a hook, however, if you disagree, I won't block.
"estree-util-value-to-estree": "^3.4.0", | ||
"estree-util-visit": "^2.0.0", | ||
"github-slugger": "^2.0.0", | ||
"glob": "^11.0.2", | ||
"hast-util-to-string": "^3.0.1", | ||
"hastscript": "^9.0.1", | ||
"html-minifier-terser": "^7.2.0", | ||
"mustache": "^4.2.0", |
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.
Hmm, why?
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 tried to use __<VARIABLE>__
like in the other generators, however, the JavaScript I was trying to add to the HTML broke the structure of the file. Using a library like Mustache properly escapes anything injected.
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.
export const TEMPLATE = ({...props}) => dedent`
<html>
${props.foo}
</html>
`;
this can work
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.
Sorry if I wasn’t clear, the compiled JavaScript broke the HTML structure because it contained characters that need to be escaped to be in an HTML script.
For example, in your scenario, if props.foo
contains a </html>
, it’ll escape the sandbox.
Mustache performs all the needed escaping.
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 don't like that we're using yet another layer of whatever freakery here. Mustache is great, but it feels like you're throing a nuke at an ant's sized problem. Not to mention adding yet another engine here will make things even more complex and costly-performance wise. Let's try to avoid throwing npm packages to any problem we encounter, shall we?
🎉 The code now dehydrates to the client so it can render without JavaScript! |
Wow 😵💫 and what about codetab |
It rehydrates and runs with JS, but if you don't have JS, you can still view the docs. I used React's SSRing |
@AugustinMauroy and I got search to finally work 🎉 |
024bbea
to
dbfe55d
Compare
@nodejs/nodejs-website @nodejs/web-infra |
Fixed.
The
Fixed.
I've changed it to
If we want to add them to "About this documentation", that's a
Fixed.
I've updated the
We could add a static (backup) navbar, and then also use #327 to load any potential changes?
That's an issue with the |
Yes, but that's not the <code> styling, these elements are written with <bold><code>ffff</code></bold> we could sanitize something or change the font for small code blocks, or the antialising because it looks quite weird and contrasting the table/theme |
Orama also supports tags and labels, hence we could for cc @micheleriva any idea here? |
We can keep it empty for now. Would be cool to have at least one entry "Go back to the Website" (i18n) BTW, have we integrated i18n on the new web gen? |
@avivkeller latest commit build failing: |
On my machine, performance tanked, I need to investigate. |
Noticed the same. |
I actually think the perf regression is a bug in tailwind. Maybe the patch they just released contained a bug. |
Indeed. Downgrading to |
I've adjusted the code tags to inherit their size.
We could add a "tags" in the YAML metadata in
Done.
|
too much upstream work. -1 |
Is it still supposed to take this much?:
|
No, I can update the CSS to remove them.
It's not a bug, if there aren't any descriptions on any of the entries, the column is omitted. Ditto for name and type. However, perhaps we should give the subtable headings if it has different columns than the parent table. |
We are also It prevents memory crashes from happening, but it exponentially slower, so I really need to improve performance. (We can also |
I think we should always render all columns .. But yeah, I also think suitable headings make sense. At the very least suitable headings and fixed paddings |
Let's think of that if all other performance improvements aren't enough |
That example was generated from the following markdown: #### `dir.path`
<!-- YAML
added: v12.12.0
-->
* {string}
The read-only path of this directory as was provided to [`fs.opendir()`][],
[`fs.opendirSync()`][], or [`fsPromises.opendir()`][]. Maybe it's just me, but it feels weird to have the table below when only
|
Moving to draft until the following performance improvements are completed (dynamic list, feel free to add more items):
Footnotes
|
Fixes #7.
This PR adds the web generator.
Tasks / Issues
P1 – Must Complete Before Merge
P2 – Must complete before migration
ChangeHistory
component doesn’t render Markdown correctly. (Seeentry.changes
aren't converted to HTML #326)P3 – Can Be Done in a Follow-up
mustache
dependencyGet a preview
Footnotes
Add things as they appear, or leave review comments. ↩ ↩2 ↩3