Add html rendering pathway - #3027
Conversation
|
There was a problem hiding this comment.
A few comments when looking on my phone on pushing more responsibility to the render function if it is provided.
I would say we go all or nothing TBH. If there is a render html, it should do everything (including favicon, sitemap, js copy). "Given this content make it an html site in this directory".
| // This always includes the thebe JS chunks, even when no project enables | ||
| // `thebe`/`jupyter`. The myst-theme uses thebe-core to render Jupyter cell | ||
| // outputs, so these chunks are required for outputs to render at all. | ||
| const templateBuildDir = path.join(template.templatePath, 'public'); | ||
| fs.copySync(templateBuildDir, htmlDir); |
There was a problem hiding this comment.
This should probably be the responsibility of theme render function if provided of ensuring all assets are available. (Might need to pass template directory in as env variable?)
There was a problem hiding this comment.
This code-path is only for the existing rendering (if a template doesn't support HTML rendering). My view is that we deprecate this, but remove it later.
| // We need to go through and change all links to the right folder | ||
| rewriteAssetsFolder(htmlDir, baseurl); | ||
| } | ||
| await appServer.stop(); |
There was a problem hiding this comment.
If the template is in charge of rendering html, then we shouldn't have to start the server (some could probably do it without a server, but it should be a template choice).
There was a problem hiding this comment.
Yep, we only want the content server. To-do!
|
@rowanc1 yes - this is a WIP that I wanted to push whilst I'm OoO! There are nuances around non route paths, but I've made some progress on the theme side to just proxy those routes such that we should be able to eliminate special cases on the mystmd side |
9f3ca76 to
b52fb29
Compare
Our existing HTML rendering pathway is facilitated by
mystmd. There's no direct need to do things this way. This PR adds an opt-in rendering pathway for themes to implement HTML rendering, which permits a theme to e.g. use a SSG approach.