Skip to content

Commit 1bd1058

Browse files
authored
Sphinx docs gh-pages implementation (#453)
- using the Sphinx docs framework. - restructured docs into directories to create some high level organisation. - initialised as a zk notebook for quick editing and zk specific workflow enhancements. - docs development, local build steps and requirements to be documented in subsequent PR.
1 parent ea9cbbb commit 1bd1058

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1715
-822
lines changed

.gitignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,30 @@
2020
# IDEs/Editors
2121
.vscode/
2222

23+
# Zk specific
2324
notebook.db
2425
zk
26+
27+
# Sphinx Docs / Python #
28+
# created by `make docs` for building documentation locally
29+
docs-build/
30+
31+
# Installer logs
32+
pip-log.txt
33+
pip-delete-this-directory.txt
34+
35+
# Environments
36+
.env
37+
.venv
38+
env/
39+
venv/
40+
ENV/
41+
env.bak/
42+
venv.bak/
43+
44+
# ruff
45+
.ruff_cache/
46+
47+
# LSP config files
48+
pyrightconfig.json
49+

.prettierrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
printWidth: 80
2+
proseWrap: "always"

CONTRIBUTING.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,7 @@ Binaries can be created automatically using `make dist-linux` and `make dist-mac
6060
Unfortunately, `make dist-macos` must be run manually on both an Apple Silicon and Intel chips. The Linux builds are created using Docker and [these custom images](https://github.com/zk-org/zk-xcompile), which are hosted via [ghcr.io within zk-org](https://github.com/orgs/zk-org/packages/container/package/zk-xcompile).
6161

6262
This process is convoluted because `zk` requires CGO with `mattn/go-sqlite3`, which prevents using Go's native cross-compilation. Transitioning to a CGO-free SQLite driver such as [cznic/sqlite](https://gitlab.com/cznic/sqlite) could simplify the distribution process significantly.
63+
64+
## Documentation
65+
66+
TODO: add documentation steps for Sphinx docs, after it's all working.

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,17 @@ dist-alpine-i386:
6060
&& docker run --rm -v "${PWD}":/usr/src/zk -w /usr/src/zk ghcr.io/zk-org/zk-xcompile:alpine-i386 /bin/bash -c 'make alpine' \
6161
&& tar -zcvf "zk-${VERSION}-alpine-i386.tar.gz" zk
6262

63-
# Clean build products.
63+
# Clean build and docs products.
6464
clean:
6565
rm -rf zk*
66+
rm -rf docs-build
6667

68+
### Sphinx Docs ###
69+
# Catch-all target: route all unknown targets to Sphinx using the new
70+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
71+
docs: Makefile
72+
mkdir -p docs-build
73+
sphinx-build -a docs docs-build
6774

6875
VERSION := `git describe --tags --match v[0-9]* 2> /dev/null`
6976
BUILD := `git rev-parse --short HEAD`

docs/.zk/config.toml

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
# zk configuration file
2+
#
3+
# Uncomment the properties you want to customize.
4+
5+
# NOTE SETTINGS
6+
#
7+
# Defines the default options used when generating new notes.
8+
[note]
9+
10+
# Language used when writing notes.
11+
# This is used to generate slugs or with date formats.
12+
#language = "en"
13+
14+
# The default title used for new note, if no `--title` flag is provided.
15+
#default-title = "Untitled"
16+
17+
# Template used to generate a note's filename, without extension.
18+
#filename = "{{id}}"
19+
20+
# The file extension used for the notes.
21+
#extension = "md"
22+
23+
# Template used to generate a note's content.
24+
# If not an absolute path or "~/unix/path", it's relative to .zk/templates/
25+
template = "default.md"
26+
27+
# Path globs ignored while indexing existing notes.
28+
#ignore = [
29+
# "drafts/*",
30+
# "log.md"
31+
#]
32+
33+
# Configure random ID generation.
34+
35+
# The charset used for random IDs. You can use:
36+
# * letters: only letters from a to z.
37+
# * numbers: 0 to 9
38+
# * alphanum: letters + numbers
39+
# * hex: hexadecimal, from a to f and 0 to 9
40+
# * custom string: will use any character from the provided value
41+
#id-charset = "alphanum"
42+
43+
# Length of the generated IDs.
44+
#id-length = 4
45+
46+
# Letter case for the random IDs, among lower, upper or mixed.
47+
#id-case = "lower"
48+
49+
50+
# EXTRA VARIABLES
51+
#
52+
# A dictionary of variables you can use for any custom values when generating
53+
# new notes. They are accessible in templates with {{extra.<key>}}
54+
[extra]
55+
56+
#key = "value"
57+
58+
59+
# GROUP OVERRIDES
60+
#
61+
# You can override global settings from [note] and [extra] for a particular
62+
# group of notes by declaring a [group."<name>"] section.
63+
#
64+
# Specify the list of directories which will automatically belong to the group
65+
# with the optional `paths` property.
66+
#
67+
# Omitting `paths` is equivalent to providing a single path equal to the name of
68+
# the group. This can be useful to quickly declare a group by the name of the
69+
# directory it applies to.
70+
71+
#[group."<NAME>"]
72+
#paths = ["<DIR1>", "<DIR2>"]
73+
#[group."<NAME>".note]
74+
#filename = "{{format-date now}}"
75+
#[group."<NAME>".extra]
76+
#key = "value"
77+
78+
79+
# MARKDOWN SETTINGS
80+
[format.markdown]
81+
82+
# Format used to generate links between notes.
83+
# Either "wiki", "markdown" or a custom template. Default is "markdown".
84+
#link-format = "wiki"
85+
# Indicates whether a link's path will be percent-encoded.
86+
# Defaults to true for "markdown" format and false for "wiki" format.
87+
#link-encode-path = true
88+
# Indicates whether a link's path file extension will be removed.
89+
# Defaults to true.
90+
#link-drop-extension = true
91+
92+
# Enable support for #hashtags.
93+
hashtags = true
94+
# Enable support for :colon:separated:tags:.
95+
colon-tags = false
96+
# Enable support for Bear's #multi-word tags#
97+
# Hashtags must be enabled for multi-word tags to work.
98+
multiword-tags = false
99+
100+
101+
# EXTERNAL TOOLS
102+
[tool]
103+
104+
# Default editor used to open notes. When not set, the EDITOR or VISUAL
105+
# environment variables are used.
106+
#editor = "vim"
107+
108+
# Pager used to scroll through long output. If you want to disable paging
109+
# altogether, set it to an empty string "".
110+
#pager = "less -FIRX"
111+
112+
# Command used to preview a note during interactive fzf mode.
113+
# Set it to an empty string "" to disable preview.
114+
115+
# bat is a great tool to render Markdown document with syntax highlighting.
116+
#https://github.com/sharkdp/bat
117+
#fzf-preview = "bat -p --color always {-1}"
118+
119+
120+
# LSP
121+
#
122+
# Configure basic editor integration for LSP-compatible editors.
123+
# See https://github.com/zk-org/zk/blob/main/docs/editors-integration.md
124+
#
125+
[lsp]
126+
127+
[lsp.diagnostics]
128+
# Each diagnostic can have for value: none, hint, info, warning, error
129+
130+
# Report titles of wiki-links as hints.
131+
#wiki-title = "hint"
132+
# Warn for dead links between notes.
133+
dead-link = "error"
134+
135+
[lsp.completion]
136+
# Customize the completion pop-up of your LSP client.
137+
138+
# Show the note title in the completion pop-up, or fallback on its path if empty.
139+
#note-label = "{{title-or-path}}"
140+
# Filter out the completion pop-up using the note title or its path.
141+
#note-filter-text = "{{title}} {{path}}"
142+
# Show the note filename without extension as detail.
143+
#note-detail = "{{filename-stem}}"
144+
145+
146+
# NAMED FILTERS
147+
#
148+
# A named filter is a set of note filtering options used frequently together.
149+
#
150+
[filter]
151+
152+
# Matches the notes created the last two weeks. For example:
153+
# $ zk list recents --limit 15
154+
# $ zk edit recents --interactive
155+
#recents = "--sort created- --created-after 'last two weeks'"
156+
157+
158+
# COMMAND ALIASES
159+
#
160+
# Aliases are user commands called with `zk <alias> [<flags>] [<args>]`.
161+
#
162+
# The alias will be executed with `$SHELL -c`, please refer to your shell's
163+
# man page to see the available syntax. In most shells:
164+
# * $@ can be used to expand all the provided flags and arguments
165+
# * you can pipe commands together with the usual | character
166+
#
167+
[alias]
168+
# Here are a few aliases to get you started.
169+
170+
# Shortcut to a command.
171+
#ls = "zk list $@"
172+
173+
# Default flags for an existing command.
174+
#list = "zk list --quiet $@"
175+
176+
# Edit the last modified note.
177+
#editlast = "zk edit --limit 1 --sort modified- $@"
178+
179+
# Edit the notes selected interactively among the notes created the last two weeks.
180+
# This alias doesn't take any argument, so we don't use $@.
181+
#recent = "zk edit --sort created- --created-after 'last two weeks' --interactive"
182+
183+
# Print paths separated with colons for the notes found with the given
184+
# arguments. This can be useful to expand a complex search query into a flag
185+
# taking only paths. For example:
186+
# zk list --link-to "`zk path -m potatoe`"
187+
#path = "zk list --quiet --format {{path}} --delimiter , $@"
188+
189+
# Show a random note.
190+
#lucky = "zk list --quiet --format full --sort random --limit 1"
191+
192+
# Returns the Git history for the notes found with the given arguments.
193+
# Note the use of a pipe and the location of $@.
194+
#hist = "zk list --format path --delimiter0 --quiet $@ | xargs -t -0 git log --patch --"
195+
196+
# Edit this configuration file.
197+
#conf = '$EDITOR "$ZK_NOTEBOOK_DIR/.zk/config.toml"'

docs/.zk/templates/default.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# {{title}}
2+
3+
{{content}}

docs/automation.md

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

docs/conf.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# For the full list of built-in configuration values, see the documentation:
4+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
5+
6+
# -- Project information -----------------------------------------------------
7+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
8+
9+
project = "zk"
10+
copyright = "2024, zk-org"
11+
author = "zk-org"
12+
release = "0.14.1"
13+
14+
# -- General configuration ---------------------------------------------------
15+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
16+
17+
extensions = ["myst_parser"]
18+
myst_enable_extensions = ["colon_fence", "html_image"]
19+
suppress_warnings = ["myst.xref_missing", "myst.iref_ambiguous"]
20+
21+
templates_path = ["_templates"]
22+
exclude_patterns = [".zk"]
23+
24+
25+
# -- Options for HTML output -------------------------------------------------
26+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
27+
28+
html_theme = "furo"
29+
html_static_path = ["_static"]
30+
master_doc = "index"

docs/config-extra.md

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

docs/config-notebook.md

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

0 commit comments

Comments
 (0)