Skip to content

Commit

Permalink
docs: fixing snippets on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
grampelberg committed Oct 2, 2024
1 parent a5d073d commit 7867535
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 20 deletions.
22 changes: 11 additions & 11 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@
"dependencies": {
"@iconify-json/carbon": "^1.2.1",
"@iconify-json/line-md": "^1.2.1",
"@iconify-json/logos": "^1.2.0",
"@iconify-json/material-symbols": "^1.2.1",
"@iconify-json/logos": "^1.2.1",
"@iconify-json/material-symbols": "^1.2.2",
"@iconify-json/mdi": "^1.2.0",
"@theguild/remark-mermaid": "^0.1.2",
"@theguild/remark-mermaid": "^0.1.3",
"clsx": "^2.1.1",
"next": "^14.2.12",
"next": "^14.2.14",
"next-themes": "^0.3.0",
"nextra": "alpha",
"nextra-theme-docs": "alpha",
"posthog-js": "^1.162.0",
"nextra": "3.0.2",
"nextra-theme-docs": "3.0.2",
"posthog-js": "^1.166.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"remark-frontmatter": "^5.0.0",
Expand All @@ -39,14 +39,14 @@
"devDependencies": {
"@types/mdast": "^4.0.4",
"@types/mdx": "^2.0.13",
"@types/node": "^22.5.5",
"@types/react": "^18.3.8",
"@types/node": "^22.7.4",
"@types/react": "^18.3.11",
"autoprefixer": "^10.4.20",
"eslint-plugin-mdx": "^3.1.5",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-tailwindcss": "^3.17.4",
"postcss": "^8.4.45",
"tailwindcss": "^3.4.11",
"postcss": "^8.4.47",
"tailwindcss": "^3.4.13",
"typescript": "^5.6.2"
}
}
18 changes: 9 additions & 9 deletions docs/pages/blog/2024-09-30-use-kube-rs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ The `kube-rs` client iterates on the `controller-runtime` API and makes it a
little bit more rust-like. Here's an example of how you'd use each of these side
by side:

```go
```go filename="Go"
pod := &corev1.Pod{}
if err := c.Get(context.Background(), client.ObjectKey{
Namespace: "namespace",
Expand All @@ -75,7 +75,7 @@ if err := c.Get(context.Background(), client.ObjectKey{
}
```

```rust
```rust filename="Rust"
let pod = Api::<Pod>::namespaced(client, "namespace").get("name").await?;
```

Expand All @@ -94,7 +94,7 @@ the API. Getting a log stream is just as easy as getting a pod:

[kube-rs-examples]: https://github.com/kube-rs/kube/tree/main/examples

```rust
```rust filename="Rust"
let logs = Api::<Pod>::namespaced(client, "namespace")
.log_stream("my-container", &LogStreamOptions::default())
.await?;
Expand All @@ -106,7 +106,7 @@ provides a whole set of [added functionality][resourceext] that is common across
all resources. My favorite part is that you can write your own. In `kty` we have
some generic ones to output some YAML:

```rust
```rust filename="Rust"
pub trait Yaml<K>
where
K: Resource + Serialize,
Expand All @@ -127,7 +127,7 @@ where
There are also resource specific ones that we're using to easily format a pod
object for display:

```rust
```rust filename="Rust"
pub trait PodExt {
fn age(&self) -> TimeDelta;
fn ready(&self) -> String;
Expand Down Expand Up @@ -159,7 +159,7 @@ than doing it for a specific resource (or `Pod`). From an implementation
perspective, specific resources simply have the required configuration already
associated with themselves.

```rust
```rust filename="Rust"
let resource = Api::namespaced_with(client, "namespace", ApiResource::from_gvk(&group_version_kind))
.get("foo")?;
```
Expand Down Expand Up @@ -194,7 +194,7 @@ Here's an example of how these layer together. A deployment client is created
and a watcher is attached to that client. The writer returned from the store is
attached to the watcher and that whole thing is thrown into a background task.

```rust
```rust filename="Rust"
let api: Api<Deployment> = Api::all(client);

let (reader, writer) = reflector::store();
Expand Down Expand Up @@ -246,7 +246,7 @@ The tool that does this generation is [controller-gen][controller-gen]. It looks
for specially formatted comments that have been added to structs. These dictate
how client code is generated and it looks something like:

```go
```go filename="Go"
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status

Expand All @@ -266,7 +266,7 @@ any problems immediately show up in your editor and you can reduce the debugging
cycle of "edit" -> "generate" -> "compile" -> "test". For `kube-rs`, it'll take
a spec and generate the rest for you:

```rust
```rust filename="Rust"
#[derive(CustomResource, Clone, Debug, Serialize, Deserialize, JsonSchema)]
#[kube(
group = "example.com",
Expand Down
3 changes: 3 additions & 0 deletions docs/pages/blog/_meta.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ export default {
sidebar: false,
timestamp: true,
layout: 'default',
theme: {
typesetting: 'article',
},
topContent: function TopContent() {
const { frontMatter } = useConfig()
const { title, byline } = frontMatter
Expand Down

0 comments on commit 7867535

Please sign in to comment.