From 2867d41998b7da75d815816ef29b15a2ae57480e Mon Sep 17 00:00:00 2001 From: object-Object Date: Sun, 9 Jun 2024 23:56:51 -0400 Subject: [PATCH] Allow adding custom links to the web book navbar --- CHANGELOG.md | 6 ++++ noxfile.py | 12 +++++++ .../_templates/components/navbar.html.jinja | 18 ++++++++-- src/hexdoc/_templates/index.css.jinja | 6 ++++ .../_templates/macros/formatting.html.jinja | 17 +++++++++ .../03-template/_external_link_icon.md | 4 +++ .../docs/03-guides/03-template/example.png | Bin 0 -> 4012 bytes .../docs/03-guides/03-template/index.md | 34 ++++++++++++++++++ .../{03-spoilers => 05-spoilers}/example.png | Bin .../{03-spoilers => 05-spoilers}/index.md | 0 .../01-model-rendering/amethyst_sconce.png | Bin .../01-model-rendering/anvil.png | Bin .../01-model-rendering/edified_stairs.png | Bin .../01-model-rendering/index.md | 0 .../01-model-rendering/sculk_shrieker.png | Bin .../02-patchouli-schemas.md | 0 .../_category_.yml | 0 17 files changed, 95 insertions(+), 2 deletions(-) create mode 100644 web/docusaurus/docs/03-guides/03-template/_external_link_icon.md create mode 100644 web/docusaurus/docs/03-guides/03-template/example.png create mode 100644 web/docusaurus/docs/03-guides/03-template/index.md rename web/docusaurus/docs/03-guides/{03-spoilers => 05-spoilers}/example.png (100%) rename web/docusaurus/docs/03-guides/{03-spoilers => 05-spoilers}/index.md (100%) rename web/docusaurus/docs/03-guides/{05-standalone => 06-standalone}/01-model-rendering/amethyst_sconce.png (100%) rename web/docusaurus/docs/03-guides/{05-standalone => 06-standalone}/01-model-rendering/anvil.png (100%) rename web/docusaurus/docs/03-guides/{05-standalone => 06-standalone}/01-model-rendering/edified_stairs.png (100%) rename web/docusaurus/docs/03-guides/{05-standalone => 06-standalone}/01-model-rendering/index.md (100%) rename web/docusaurus/docs/03-guides/{05-standalone => 06-standalone}/01-model-rendering/sculk_shrieker.png (100%) rename web/docusaurus/docs/03-guides/{05-standalone => 06-standalone}/02-patchouli-schemas.md (100%) rename web/docusaurus/docs/03-guides/{05-standalone => 06-standalone}/_category_.yml (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0f1edd2..351f0417 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and [Pydantic's HISTORY.md](https://github.com/pydantic/pydantic/blob/main/HISTORY.md), and this project *mostly* adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [UNRELEASED] + +### Added + +* Allow adding custom links to the web book navbar ([docs](https://hexdoc.hexxy.media/docs/guides/template)). + ## `1!0.1.0a18` ### Fixed diff --git a/noxfile.py b/noxfile.py index ea897acc..0b2d3642 100644 --- a/noxfile.py +++ b/noxfile.py @@ -507,6 +507,18 @@ def dummy_setup(session: nox.Session): mod_name = "Dummy" author = "author" show_landing_text = true + + [template.args.navbar] + left = [ + { text="Left", href="https://google.ca" }, + ] + center = [ + { text="Center 1", href="https://google.ca", external=false }, + { text="Center 2", href="https://google.ca", external=false, icon="box-arrow-down-right" }, + ] + right = [ + { text="Right", href="https://google.ca", icon="box-arrow-up-left" }, + ] """ ), "nodemon.json": { diff --git a/src/hexdoc/_templates/components/navbar.html.jinja b/src/hexdoc/_templates/components/navbar.html.jinja index f29e0e3e..2ff8a91d 100644 --- a/src/hexdoc/_templates/components/navbar.html.jinja +++ b/src/hexdoc/_templates/components/navbar.html.jinja @@ -1,6 +1,7 @@ +{% import "macros/formatting.html.jinja" as fmt with context -%} +