-
Notifications
You must be signed in to change notification settings - Fork 351
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
Website v2 #143
Comments
I like this proposal a lot: I think it's substantially superior to all three of the other options listed. Integrating Awesome Bevy directly into the website would be lovely; I think it deserves both a nicer UI and better visibility at this point. I'm not sure if it should be in the same repo or another. |
Awesome BevyI agree that awesome-bevy should be built into the main bevy website. I really like having awesome-bevy in another repo for "separation of concerns" reasons. We can treat it like a database to be queried and we don't conflate "core website changes" with "new community plugins/games/etc", which will likely continue to increase in frequency (and would therefore create a bunch of noise in the bevy-website repo). The biggest downside is ensuring the website is updated when awesome-bevy is updated. Using a single repo would trivially ensure that awesome-bevy has valid content and that every change is automatically deployed. But that seems like a solvable problem:
Bevy Book Tech StackI'm not yet convinced that the addition of mdbook is a net win. Zola-everywhere has a number of benefits:
The biggest missing piece that mdbook provides but bevy-website is missing is rust code-block validation. But that actually feels relatively straightforward to me:
The command above properly validates the "hello world" codeblock in the getting started guide (first run is valid content, second run introduces a bug): |
I'm now realizing the file path is already part of the error message. So we would probably just use |
There is also the matter of letting rustdoc know where to find dependencies (such as the |
It looks like @alice-i-cecile's "Understanding Bevy" book and @jamadazi's "Bevy Cheatbook" actually both avoid using the rustdoc validation, in favor of just embedding content from rust crates validated using normal I think we should support both patterns. By default, we should favor directly-embedded code as this keeps the code close to the context and avoids the "line number file filter" errors introduced by something like `{{ import ../my_crate/foo.rs lines 0-10 }}``. But embedding content from external crates avoids code duplication for large examples introduced across many code snippets. Therefore I propose:
|
This was courtesy of @mockersf's setup in my case <3 If we're extending Zola to do this, we should try to upstream it as well. Less maintenance burden in the long-run, and I'm sure it's a feature others will appreciate. |
The idea was not to snipe you into making it 😄 So you feel strongly about keeping everything with Zola. It is possible, but will require more elbow grease in the CI to build it 👍
Are you ok with that plan?
I like this pattern as it provides a complete context on how to run a snippet, and is nice to split a tutorial into step by step |
No worries! I definitely didn't interpret it that way. I just had enough Zola context to know it should be doable and enough motivation to compare that type of implementation to what mdBook does.
Yeah I agree with all of that. Just gotta be a bit careful about "accidental offset errors" when someone makes a change to the code (or even just runs cargo fmt) and moves the desired line numbers to a position outside of the range referenced. Code blocks using this approach will require extra diligence on our part (which is why inline should be the default).
Yeah before committing to skeptic someone needs to do a quick proof of concept (in the context of the Bevy Book) to make sure the workflow is ideal. I'm a little afraid the templates will be overly limiting, whereas rustdoc is pretty flexible. Solving the rustdoc dependency problem in a clean way will be challenging, but probably not impossible (and maybe solved by someone already). Also both skeptic and rustdoc will rely on us solving the "ignored line" problem. Most inline code blocks will require some "context" that isn't rendered, but helps the example compile. rustdoc normally supports filtering out "hashtag lines" like Doing hashtag filtering would require a pre-pass of some kind:
We could also just rely on skeptic templates for "hidden content". But unfortunately using the skeptic template syntax breaks syntax highlighting in zola. Ex: starting a code block with If we can't find some way to solve the "hidden code for inline blocks" problem cleanly (or we're blocked by Zola upstreaming a feature we need), we might need to just rely on "external code blocks" completely when code validation is required. Pulling in @Keats (creator of Zola) for input here as they have contributed to the Bevy Book in the past / seem interested in helping us out 😄 |
Better than filtering by line number, there is filtering by code block delimited by anchors (see the part that starts with
I used skeptic in the past and read it's source recently to check if we could use it, I think it's the best way forward with Zola. We will need to change Zola language resolution anyway because we may want to have code blocks annotated with |
Ooh yeah I'm sold. Implementing this should be possible will zola/tera templates using a combination of the split/starting_with functions (ex: split the file by newlines, iterate over lines and find those starting with
Yup this doesn't seem particularly contentious and seems like a very scoped investment / quick win. We'll also want to see if skeptic handles zola's "markdown header metadata" syntax properly, otherwise we'll need to add a preprocessor to strip it out. |
Oooh so you guys want to implement mdbook anchor syntax in Zola? 👀 👀 👀 So, this should allow the official book to work kinda like Cheatbook, but in Zola instead of mdbook? 👀 |
Zola actually already more or less support that, but right now it ignores tokens it doesn't know and consider the last token to be the language. if skeptic doesn't care about the ordering it should work already 👍 it also has a |
Anything you need from Zola? |
Short term I don't think so. Soon we should know whether the zola and skeptic code block language formats are compatible with each other. If they aren't, then we'll need to sort out the best way to resolve that (ex: we might request that zola defaults to the first language in a comma separated list instead of the last language, or we might do the reverse for skeptic). Not sure if theres a spec for that / what sort of precedent the wider markdown ecosystem has set. |
tried integrating with skeptic, should work well but build issue with native libs: #148 |
and other version including code blocks from a validated crate: #150 |
Ooh you implemented anchors. Very nice :) |
yup I wanted to have the two options for comparison |
I think all of the main questions in this are now resolved, and we're sticking with Zola. Any remaining nits should go in their own issues, so we can address them properly. |
Website would be made of several parts:
Awesome Bevy part would pull from another repo files describing all the community contributions and display them integrated in the website (bevyengine/bevy-assets#71)
Work needed for that:
Downsides:
Other options:
What do you think?
The text was updated successfully, but these errors were encountered: