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

Use TOML for example readme frontmatter #4553

Merged
merged 27 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5beee75
update example readmes and manifest
jprochazk Dec 15, 2023
553c68d
update all readme frontmatter to toml
jprochazk Dec 15, 2023
37e47f6
update frontmatter parsing to use toml
jprochazk Dec 15, 2023
4506843
support HTML comment frontmatter in python
jprochazk Dec 15, 2023
cf4a4f8
support HTML comment frontmatter in rust
jprochazk Dec 15, 2023
bedfe49
update example READMEs to use HTML comment frontmatter
jprochazk Dec 15, 2023
26ba4d5
Merge branch 'main' into jan/toml-manifest
jprochazk Dec 15, 2023
4fb66a7
sort import block
jprochazk Dec 15, 2023
1bdb02f
fix lint
jprochazk Dec 15, 2023
ad98944
fix newlines
jprochazk Dec 15, 2023
b969fbb
fix duplicate toml_edit dependency
jprochazk Dec 15, 2023
72047ad
check for `None`
jprochazk Dec 15, 2023
3281544
remove `manifest.yml`
jprochazk Dec 15, 2023
ef0d9f3
try to fix linkinator
jprochazk Dec 15, 2023
2e0be05
try skip the link instead
jprochazk Dec 15, 2023
77e78ab
ignore `static.rerun.io` links
jprochazk Dec 15, 2023
fc8528b
undo ignoring `static.rerun.io` links
jprochazk Dec 15, 2023
e9ab955
skip more links...
jprochazk Dec 15, 2023
f8ad8ad
update `metadata` to be an actual html comment
jprochazk Dec 16, 2023
a650197
add `order` to manifest
jprochazk Dec 16, 2023
6eae5b2
Merge branch 'main' into jan/toml-manifest
jprochazk Dec 16, 2023
08ffc77
Merge branch 'main' into jan/toml-manifest
emilk Dec 19, 2023
da186c5
Remove dependencies on python-frontmatter
emilk Dec 19, 2023
80ff3fe
Better error message
emilk Dec 19, 2023
e4e086c
Remove default features for `toml` crate
emilk Dec 19, 2023
394ad54
Reuse the same `load_frontmatter` function
emilk Dec 19, 2023
7588e64
fix importing of frontmatter.py
emilk Dec 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 49 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ serde = "1"
serde_bytes = "0.11"
serde_json = { version = "1", default-features = false, features = ["std"] }
serde_test = "1"
serde_yaml = { version = "0.9.21", default-features = false }
sha2 = "0.10"
similar-asserts = "1.4.2"
slotmap = { version = "1.0.6", features = ["serde"] }
Expand All @@ -210,6 +209,7 @@ tinyvec = { version = "1.6", features = ["alloc", "rustc_1_55"] }
tobj = "4.0"
tokio = { version = "1.24", default-features = false }
tokio-tungstenite = { version = "0.17.1", default-features = false }
toml = "0.8.8"
tracing = { version = "0.1", default-features = false }
tungstenite = { version = "0.17", default-features = false }
type-map = "0.5"
Expand Down
2 changes: 1 addition & 1 deletion crates/re_build_examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ argh.workspace = true
indicatif.workspace = true
rayon.workspace = true
serde = { workspace = true, features = ["derive"] }
serde_yaml.workspace = true
serde_json.workspace = true
toml = { workspace = true, features = ["preserve_order"] }
14 changes: 6 additions & 8 deletions crates/re_build_examples/src/example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,10 @@ fn parse_frontmatter<P: AsRef<Path>>(path: P) -> anyhow::Result<Option<Frontmatt
let Some(end) = content.find("---") else {
anyhow::bail!("{:?} has invalid frontmatter: missing --- terminator", path);
};
Ok(Some(serde_yaml::from_str(&content[..end]).map_err(
|err| {
anyhow::anyhow!(
"failed to read {:?}: {err}",
path.parent().unwrap().file_name().unwrap()
)
},
)?))
Ok(Some(toml::from_str(&content[..end]).map_err(|err| {
anyhow::anyhow!(
"failed to read {:?}: {err}",
path.parent().unwrap().file_name().unwrap()
)
})?))
}
9 changes: 3 additions & 6 deletions examples/c/spawn_viewer/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
---
title: Spawn Viewer
tags: [spawn]
c: https://github.com/rerun-io/rerun/tree/latest/examples/c/spawn_viewer/main.c
cpp: https://github.com/rerun-io/rerun/tree/latest/examples/cpp/spawn_viewer/main.cpp
rust: https://github.com/rerun-io/rerun/tree/latest/examples/rust/spawn_viewer/src/main.rs
title = "Spawn Viewer"
tags = ["spawn"]
---

Shows how to spawn a new Rerun Viewer process ready to listen for TCP connections using an executable available in PATH.

```bash
make run
```
```
9 changes: 3 additions & 6 deletions examples/cpp/clock/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
---
title: Clock
python: https://github.com/rerun-io/rerun/tree/latest/examples/python/clock/main.py
rust: https://github.com/rerun-io/rerun/tree/latest/examples/rust/clock/src/main.rs
cpp: https://github.com/rerun-io/rerun/tree/latest/examples/cpp/clock/main.cpp
thumbnail: https://static.rerun.io/clock/ae4b8970edba8480431cb71e57b8cddd9e1769c7/480w.png
title = "Clock"
thumbnail = "https://static.rerun.io/clock/ae4b8970edba8480431cb71e57b8cddd9e1769c7/480w.png"
---

<picture>
Expand All @@ -22,4 +19,4 @@ To build it from a checkout of the repository (requires a Rust toolchain):
cmake .
cmake --build . --target example_clock
./examples/cpp/clock/example_clock
```
```
17 changes: 7 additions & 10 deletions examples/cpp/dna/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
---
title: Helix
python: https://github.com/rerun-io/rerun/tree/latest/examples/python/dna/main.py
rust: https://github.com/rerun-io/rerun/tree/latest/examples/rust/dna/src/main.rs
cpp: https://github.com/rerun-io/rerun/tree/latest/examples/cpp/dna/main.cpp
tags: [3d, api-example]
description: "Simple example of logging point and line primitives to draw a 3D helix."
thumbnail: https://static.rerun.io/helix/f4c375546fa9d24f7cd3a1a715ebf75b2978817a/480w.png
thumbnail_dimensions: [480, 285]
channel: main
title = "Helix"
tags = ["3d", "api-example"]
description = "Simple example of logging point and line primitives to draw a 3D helix."
thumbnail = "https://static.rerun.io/helix/f4c375546fa9d24f7cd3a1a715ebf75b2978817a/480w.png"
thumbnail_dimensions = [480, 285]
channel = "main"
---

<picture>
Expand All @@ -26,4 +23,4 @@ To build it from a checkout of the repository (requires a Rust toolchain):
cmake .
cmake --build . --target example_dna
./examples/cpp/dna/example_dna
```
```
12 changes: 6 additions & 6 deletions examples/cpp/eigen_opencv/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title: "Eigen and OpenCV C++ Integration"
cpp: https://github.com/rerun-io/cpp-example-opencv-eigen
tags: [2D, 3D, C++, Eigen, OpenCV]
thumbnail: https://static.rerun.io/cpp-example-opencv-eigen/2fc6355fd87fbb4d07cda384ee8805edb68b5e01/480w.png
thumbnail_dimensions: [480, 267]
title = "Eigen and OpenCV C++ Integration"
source = "https://github.com/rerun-io/cpp-example-opencv-eigen"
tags = ["2D", "3D", "C++", "Eigen", "OpenCV"]
thumbnail = "https://static.rerun.io/cpp-example-opencv-eigen/2fc6355fd87fbb4d07cda384ee8805edb68b5e01/480w.png"
thumbnail_dimensions = [480, 267]
---

This is a minimal CMake project that shows how to use Rerun in your code in conjunction with [Eigen](https://eigen.tuxfamily.org/) and [OpenCV](https://opencv.org/).
Expand All @@ -16,4 +16,4 @@ You can find the example at <https://github.com/rerun-io/cpp-example-opencv-eige
<source media="(max-width: 768px)" srcset="https://static.rerun.io/cpp-example-opencv-eigen/2fc6355fd87fbb4d07cda384ee8805edb68b5e01/768w.png">
<source media="(max-width: 1024px)" srcset="https://static.rerun.io/cpp-example-opencv-eigen/2fc6355fd87fbb4d07cda384ee8805edb68b5e01/1024w.png">
<source media="(max-width: 1200px)" srcset="https://static.rerun.io/cpp-example-opencv-eigen/2fc6355fd87fbb4d07cda384ee8805edb68b5e01/1200w.png">
</picture>
</picture>
9 changes: 3 additions & 6 deletions examples/cpp/minimal/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
---
title: Minimal example
python: https://github.com/rerun-io/rerun/tree/latest/examples/python/minimal/main.py
rust: https://github.com/rerun-io/rerun/tree/latest/examples/rust/minimal/src/main.rs
cpp: https://github.com/rerun-io/rerun/tree/latest/examples/cpp/minimal/main.cpp
thumbnail: https://static.rerun.io/minimal/0e47ac513ab25d56cf2b493128097d499a07e5e8/480w.png
title = "Minimal example"
thumbnail = "https://static.rerun.io/minimal/0e47ac513ab25d56cf2b493128097d499a07e5e8/480w.png"
---

<picture>
Expand All @@ -22,4 +19,4 @@ To build it from a checkout of the repository (requires a Rust toolchain):
cmake .
cmake --build . --target example_minimal
./examples/cpp/minimal/example_minimal
```
```
6 changes: 2 additions & 4 deletions examples/cpp/shared_recording/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
---
title: Shared Recording
rust: https://github.com/rerun-io/rerun/tree/latest/examples/rust/shared_recording/src/main.rs?speculative-link
cpp: https://github.com/rerun-io/rerun/tree/latest/examples/cpp/shared_recording/main.cpp?speculative-link
title = "Shared Recording"
---

<picture>
Expand All @@ -23,4 +21,4 @@ cmake --build . --target example_shared_recording
Run the following multiple times, and you'll see that each invocation adds data to the existing recording rather than creating a new one:
```bash
./examples/cpp/shared_recording/example_shared_recording
```
```
9 changes: 3 additions & 6 deletions examples/cpp/spawn_viewer/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
---
title: Spawn Viewer
tags: [spawn]
c: https://github.com/rerun-io/rerun/tree/latest/examples/c/spawn_viewer/main.c
cpp: https://github.com/rerun-io/rerun/tree/latest/examples/cpp/spawn_viewer/main.cpp
rust: https://github.com/rerun-io/rerun/tree/latest/examples/rust/spawn_viewer/src/main.rs
title = "Spawn Viewer"
tags = ["spawn"]
---

Shows how to spawn a new Rerun Viewer process ready to listen for TCP connections using an executable available in PATH.
Expand All @@ -12,4 +9,4 @@ Shows how to spawn a new Rerun Viewer process ready to listen for TCP connection
cmake .
cmake --build . --target spawn_viewer
./examples/cpp/spawn_viewer/spawn_viewer
```
```
9 changes: 3 additions & 6 deletions examples/cpp/stdio/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
---
title: Standard Input/Output example
python: https://github.com/rerun-io/rerun/tree/latest/examples/python/stdio/main.py?speculative-link
rust: https://github.com/rerun-io/rerun/tree/latest/examples/rust/stdio/src/main.rs?speculative-link
cpp: https://github.com/rerun-io/rerun/tree/latest/examples/cpp/stdio/main.cpp?speculative-link
thumbnail: https://static.rerun.io/stdio/25c5aba992d4c8b3861386d8d9539a4823dca117/480w.png
title = "Standard Input/Output example"
thumbnail = "https://static.rerun.io/stdio/25c5aba992d4c8b3861386d8d9539a4823dca117/480w.png"
---

<picture>
Expand All @@ -21,4 +18,4 @@ To build it from a checkout of the repository (requires a Rust toolchain):
cmake .
cmake --build . --target example_stdio
echo 'hello from stdin!' | ./examples/cpp/stdio/example_stdio | rerun -
```
```
12 changes: 6 additions & 6 deletions examples/cpp/vrs/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title: "VRS Viewer"
cpp: https://github.com/rerun-io/cpp-example-vrs
tags: [2D, 3D, vrs, viewer, C++]
thumbnail: https://static.rerun.io/cpp-example-vrs/c765460d4448da27bb9ee2a2a15f092f82a402d2/480w.png
thumbnail_dimensions: [480, 286]
title = "VRS Viewer"
source = "https://github.com/rerun-io/cpp-example-vrs"
tags = ["2D", "3D", "vrs", "viewer", "C++"]
thumbnail = "https://static.rerun.io/cpp-example-vrs/c765460d4448da27bb9ee2a2a15f092f82a402d2/480w.png"
thumbnail_dimensions = [480, 286]
---

This is an example that shows how to use [Rerun](https://github.com/rerun-io/rerun)'s C++ API to log and view [VRS](https://github.com/facebookresearch/vrs) files.
Expand All @@ -17,4 +17,4 @@ You can find the example at <https://github.com/rerun-io/cpp-example-vrs>.
<source media="(max-width: 480px)" srcset="https://static.rerun.io/cpp-example-vrs/c765460d4448da27bb9ee2a2a15f092f82a402d2/480w.png">
<source media="(max-width: 768px)" srcset="https://static.rerun.io/cpp-example-vrs/c765460d4448da27bb9ee2a2a15f092f82a402d2/768w.png">
<source media="(max-width: 1024px)" srcset="https://static.rerun.io/cpp-example-vrs/c765460d4448da27bb9ee2a2a15f092f82a402d2/1024w.png">
</picture>
</picture>
Loading
Loading