Skip to content

Commit 5892069

Browse files
committed
WIP: migrate to mdbook 0.5.0
1 parent 9eee7a7 commit 5892069

File tree

8 files changed

+19
-333
lines changed

8 files changed

+19
-333
lines changed

docs/book/book.toml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[book]
22
authors = ["The Kubebuilder Maintainers"]
3-
multilingual = false
43
src = "src"
54
title = "The Kubebuilder Book"
65

76
[output.html]
7+
theme="theme/css"
88
smart-punctuation = true
99
additional-css = ["theme/css/markers.css", "theme/css/custom.css", "theme/css/version-dropdown.css"]
1010
git-repository-url = "https://github.com/kubernetes-sigs/kubebuilder"
@@ -15,9 +15,3 @@ command = "./litgo.sh"
1515

1616
[preprocessor.markerdocs]
1717
command = "./markerdocs.sh"
18-
19-
[context.environment]
20-
environment = { GO_VERSION = "1.23" }
21-
22-
[context.deploy-preview.environment]
23-
environment = { GO_VERSION = "1.23" }

docs/book/install-and-build.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ if [[ ${arch} == "amd64" ]]; then
3939
elif [[ ${arch} == "x86" ]]; then
4040
arch="i686"
4141
elif [[ ${arch} == "arm64" ]]; then
42-
# arm64 is not supported for v0.4.40 mdbook, so using x86_64 type.
42+
# arm64 is not supported for v0.4.40 mdbook, so using x86_64 type.
4343
# Once the mdbook is upgraded to latest, use 'aarch64'
4444
arch="x86_64"
4545
fi
@@ -58,7 +58,7 @@ case ${os} in
5858
;;
5959
linux)
6060
# works for linux, too
61-
target="unknown-${os}-gnu"
61+
target="unknown-${os}-musl"
6262
;;
6363
*)
6464
target="unknown-${os}"
@@ -67,7 +67,7 @@ esac
6767

6868
# grab mdbook
6969
# we hardcode linux/amd64 since rust uses a different naming scheme and it's a pain to tran
70-
MDBOOK_VERSION="v0.4.40"
70+
MDBOOK_VERSION="v0.5.0-beta.2" # TODO: using beta just for the migration (wait for 0.5.0 stable)
7171
MDBOOK_BASENAME="mdBook-${MDBOOK_VERSION}-${arch}-${target}"
7272
MDBOOK_URL="https://github.com/rust-lang/mdBook/releases/download/${MDBOOK_VERSION}/${MDBOOK_BASENAME}.${ext}"
7373

docs/book/src/migration/multi-group.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ mv internal/webhook/* internal/webhook/batch/
6060
For any new webhook created for a new group, the respective functions will be created under subdirectory `internal/webhook/<group>/`.
6161

6262
<aside class="note">
63+
6364
<h1>If you are using the deprecated layout go/v3</h1>
65+
6466
Then, your layout has not the internal directory. So, you will move the controller(s) under a directory with the name of the API group which it is responsible for manage.
6567

6668
```bash
@@ -127,6 +129,8 @@ The [CronJob tutorial][cronjob-tutorial] explains each of these changes in
127129
more detail (in the context of how they're generated by Kubebuilder for
128130
single-group projects).
129131

132+
</aside>
133+
130134
[multi-group-issue]: https://github.com/kubernetes-sigs/kubebuilder/issues/923 "Kubebuilder Issue #923"
131135
[cronjob-tutorial]: /cronjob-tutorial/cronjob-tutorial.md "Tutorial: Building CronJob"
132136
[migration-guide]: /migration/migration_guide_gov3_to_gov4.md "Migration from go/v3 to go/v4"

docs/book/src/reference/platform.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The following covers what you need to do to provide the support for one or more
1818

1919
The images used in workloads such as in your Pods/Deployments will need to provide the support for this other platform.
2020
You can inspect the images using a ManifestList of supported platforms using the command
21-
[docker manifest inspect <image>][docker-manifest], i.e.:
21+
[`docker manifest inspect <image>`][docker-manifest], i.e.:
2222

2323
```shell
2424
$ docker manifest inspect myregistry/example/myimage:v0.0.1

docs/book/theme/index.hbs

Lines changed: 0 additions & 317 deletions
This file was deleted.

docs/book/utils/litgo/literate.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,12 @@ func (Literate) SupportsOutput(_ string) bool { return true }
4949

5050
// Process implements plugin.Plugin
5151
func (l Literate) Process(input *plugin.Input) error {
52-
bookSrcDir := filepath.Join(input.Context.Root, input.Context.Config.Book.Src)
52+
srcDir := input.Context.Config.Book.Src
53+
if srcDir == "" {
54+
srcDir = "src" // mdBook 0.5.0 no longer populates this field
55+
}
56+
bookSrcDir := filepath.Join(input.Context.Root, srcDir)
57+
5358
return plugin.EachCommand(&input.Book, "literatego", func(chapter *plugin.BookChapter, relPath string) (string, error) {
5459
chapterDir := filepath.Dir(chapter.Path)
5560
pathInfo := filePathInfo{

docs/book/utils/markerdocs/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func (p MarkerDocs) Process(input *plugin.Input) error {
164164
content := new(strings.Builder)
165165

166166
// NB(directxman12): wrap this in a div to prevent the markdown processor from inserting extra paragraphs
167-
_, err := fmt.Fprintf(content, "<div><input checked type=\"checkbox\" class=\"markers-summarize\" id=\"markers-summarize-%[1]s\"></input><label class=\"markers-summarize\" for=\"markers-summarize-%[1]s\">Show Detailed Argument Help</label><dl class=\"markers\">", categoryAlias)
167+
_, err := fmt.Fprintf(content, "<div><input checked type=\"checkbox\" class=\"markers-summarize\" id=\"markers-summarize-%[1]s\"><label class=\"markers-summarize\" for=\"markers-summarize-%[1]s\">Show Detailed Argument Help</label><dl class=\"markers\">", categoryAlias)
168168
if err != nil {
169169
return "", fmt.Errorf("unable to render marker documentation summary: %v", err)
170170
}

docs/book/utils/plugin/input.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ type BookConfig struct {
4040

4141
// Book is an mdBook book.
4242
type Book struct {
43-
Sections []BookItem `json:"sections"`
43+
Items []BookItem `json:"items"`
4444
NonExhaustive *struct{} `json:"__non_exhaustive"`
4545
}
4646

@@ -176,8 +176,8 @@ func EachItem(parentItem *BookItem, visitor ChapterVisitor) error {
176176
// all chapters in the book.
177177
func EachItemInBook(book *Book, visitor ChapterVisitor) error {
178178
// pass a pointer to the structure, not the iteration variable
179-
for i := range book.Sections {
180-
if err := EachItem(&book.Sections[i], visitor); err != nil {
179+
for i := range book.Items {
180+
if err := EachItem(&book.Items[i], visitor); err != nil {
181181
return err
182182
}
183183
}

0 commit comments

Comments
 (0)