diff --git a/docs/stylesheets/extra.css b/docs/stylesheets/extra.css index 562ac66..ed54bbf 100644 --- a/docs/stylesheets/extra.css +++ b/docs/stylesheets/extra.css @@ -1 +1,48 @@ -.md-nav__link:first-letter { text-transform: lowercase; } +/* Menu */ +/* Decapitalize menu items, Mkdocs capilizes by default and can't be configured */ +nav nav .md-nav__link .md-ellipsis::first-letter { text-transform: lowercase } + +/* TOC */ +/* Don't wrap TOC links with spaces */ +.md-sidebar--secondary .md-nav__item { white-space: nowrap } +/* Scroll horizontal to make them accessible */ +.md-sidebar--secondary .md-sidebar__scrollwrap { overflow-x: auto } + +/* Code */ +/* Make codeblocks stand out */ +.md-typeset pre>code { border-left: 0.2rem solid var(--md-accent-fg-color) } + +/* Headings */ +/* Hide headings for functions but don't remove them, they function as deeplink targets */ +h2[id^="fn-"], +h3[id^="fn-"], +h4[id^="fn-"], +h5[id^="fn-"], +h6[id^="fn-"], +h7[id^="fn-"], +h8[id^="fn-"], +h9[id^="fn-"] { + visibility: hidden; + width: 0; + height: 0; + padding: 0; + margin: 0; +} + +/* Parameters */ +/* Format 'PARAMETERS' after highlight (div.highlight) */ +/* Match first paragraph (p) but only if it is followed by an unsorted list (ul) */ +article.md-content__inner.md-typeset div.highlight+p:has(+ul) { + padding-left: 1em; + margin-top: 0; + margin-bottom: 0; +} +/* Match first unsorted list (ul) after paragraph (p) */ +article.md-content__inner.md-typeset div.highlight+p+ul { + padding-left: 1em; + margin-top:0; +} +article.md-content__inner.md-typeset div.highlight+p+ul li { + margin-top: 0; + margin-bottom: 0; +} diff --git a/mkdocs.yml b/mkdocs.yml index 5c862d8..a7d4258 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -4,11 +4,11 @@ "markdown_extensions": - "pymdownx.highlight" - "pymdownx.superfences" + - "mdx_truly_sane_lists": + "nested_indent": 2 + "truly_sane": true "plugins": - "search": - "indexing": "titles" - "min_search_length": 2 - "prebuild_index": true "separator": "[\\s\\-\\.]+" - "minify": "minify_html": true @@ -17,6 +17,9 @@ "site_name": "cilium jsonnet library" "site_url": "https://jsonnet-libs.github.io/cilium-libsonnet" "theme": + "features": + - "navigation.tabs" + - "navigation.indexes" "name": "material" "palette": - "accent": "indigo" diff --git a/requirements.txt b/requirements.txt index 625beda..c790bf2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,3 +9,6 @@ mkdocs-minify-plugin>=0.3 # Include the theme mkdocs-material>=7.1.6 + +# Deal with list indent of 2 spaces +mdx-truly-sane-lists>=1.3