-
Notifications
You must be signed in to change notification settings - Fork 49
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
Testing documentation examples #99
Conversation
fbf87d7
to
e5c689c
Compare
e5c689c
to
86e9456
Compare
@@ -0,0 +1 @@ | |||
v16.20.2 |
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.
Not certain it's useful, but I wasn't sure which node version to use through yarn
println!("Ball altitude: {}", transform.translation.y); | ||
} | ||
} | ||
// DOCUSAURUS: stop basic_sim |
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.
for simplicity I chose to always have markers start/stop, even if we inject the whole file.
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.
note: now its // DOCUSAURUS: basic_sim stop
yarn.lock
Outdated
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 think I wrongly ran npm update
, this should probably be reverted
|
||
cp -r docs/user_guides/templates/* docs/user_guides/rust/. | ||
cp -r docs/user_guides/templates/* docs/user_guides/bevy_plugin/. | ||
cp -r docs/user_guides/templates/* docs/user_guides/javascript/. | ||
|
||
find docs/user_guides/bevy_plugin/ -type f -print0 | xargs -0 gawk -i inplace -v RS='<rapier>[^<]*</rapier>' -v ORS= '1' | ||
find docs/user_guides/bevy_plugin/ -type f -print0 | xargs -0 gsed -i '/<rapier>/,/<\/rapier>/d' |
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.
these should be reverted
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.
Still I'm curious if it's needed ; I tested from windows and mac and I didn't notice any major difference (but maybe the devil is in the details?)
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.
Let’s keep your changes. Maybe there is something weird going on my end.
// Trimming end for cross platform, on windows I had \r finishing result. | ||
assert_eq!(result.trim_end(), "correct data1 1"); |
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'm curious about an explaination as to why I'm getting "\r" ; I believe my source file only has "\n" 🤔
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 replaced all \r\n with \n ; I assume that won't be aproblem 🤷
+ a few other injection fixes
… branch to branch)
c97db84
to
284b9d3
Compare
284b9d3
to
08801ef
Compare
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.
This looks fantastic, thank you!
- Would it make sense if the
<load ... />
substitution also added the'''rust
backtics automatically? - Could we rename
<load ... />
into<example ... />
?
|
||
cp -r docs/user_guides/templates/* docs/user_guides/rust/. | ||
cp -r docs/user_guides/templates/* docs/user_guides/bevy_plugin/. | ||
cp -r docs/user_guides/templates/* docs/user_guides/javascript/. | ||
|
||
find docs/user_guides/bevy_plugin/ -type f -print0 | xargs -0 gawk -i inplace -v RS='<rapier>[^<]*</rapier>' -v ORS= '1' | ||
find docs/user_guides/bevy_plugin/ -type f -print0 | xargs -0 gsed -i '/<rapier>/,/<\/rapier>/d' |
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.
Let’s keep your changes. Maybe there is something weird going on my end.
generate_user_guides.sh
Outdated
cp -r docs/user_guides/templates/* docs/user_guides/rust/. | ||
cp -r docs/user_guides/templates/* docs/user_guides/bevy_plugin/. | ||
cp -r docs/user_guides/templates/* docs/user_guides/javascript/. |
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.
should load injected_templates ?
I decided against because the substitution is language agnostics, I'll want to use the same code for javascript injections. It also allows to add other code snippet if needs be. I'm not feeling too opinionated in this though.
I have no strong opinion on this either ; this injection could work to load another markdown file though (it's probably not a good idea as there are better tools), but I felt "load" conveys better its inner working. Alternatives considered were "file", "inject"... |
….rs into fix_doc_examples_code_test
for mut transform in positions.iter_mut() { | ||
dbg!(transform.rotation.to_axis_angle()); | ||
transform.rotation = Quat::from_rotation_z(270_f32.to_radians()); | ||
//println!("Ball altitude: {}", transform.translation.y); |
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.
@Vrixyz this doesn't seem to print ball altitude anymore.
I suspect that debug code was put here then forgotten about.
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.
Thanks! not sure what went wrong about this indeed :o
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.
Testing all examples is very time consuming, and checking them all by hand is error prone. Having an easy way to test them would help.
What this PR does:
docs-examples
, containing Rust examples (I didn't start to work on javascript)cargo check --examples
<load>
tag (in the mindset of<bevy>
,<rust>
,<js>
...docs-examples
also contains a crateinject_code
, which is responsible to parse a file, detect the load tag, and inject the code inside, keeping only relevant marked lines.templates_injected
is created, containing all the templates with injected code,in order to play well withPUBLISH_MODE=0
, so we can review templates on their aggregated page../diff_with_branch.sh
inject_file/tmp_diff
is created, containing diffs from template to injected files. Mostly for debug purposes, not sure if we keep it, I might turn this behaviour off by default./generate_user_guides.sh
script is updated to do the injection automatically.Solution considerations
It's a bit unfortunate that it creates an indirection when editing the docs (we have to go check the content of the file linked), but the alternatives being:
Migration fixes or modification details (long)
ShapeCastOptions
also related discussion on discord: https://discord.com/channels/691052431525675048/1242987460288315425/1245383515953037424
ColliderHandle
ActiveEvents::CONTACT_FORCE_EVENTS
?Bugs:
SpatialBundle
orTransformBundle
Tutorial flow notes
My feeling over going through the bevy user guide is quite positive, as it's very precise, and useful to make sense of how it works together.
It might be bit more resembling to a reference than a "guide" though, with a vibe of "it will all make sense when you finish, promise".
Suggestions:
command.spawn
for aninsert
; not obligated to end lines with;
Also, there's a lot of code shared withing this user guide, we might want to consider consolidating the crates documentation for reference, and link to those rather than re-implementing and maintaining our own rustdoc ?
Or study if we can apply some of ideas from https://diataxis.fr/