Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge in upstream changes from mkdocs-material #338

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
7b06097
Merge in upstream changes from mkdocs-material
jbms Mar 31, 2024
b74740a
add missing __init__.py
2bndy5 Apr 11, 2024
8f7365b
doc auto color palette option and use it :)
2bndy5 Apr 11, 2024
09e43e2
re-enable code copy button & add doc link about related feature
2bndy5 Apr 11, 2024
56e26d6
let search plugin fail silently for non-html builders
2bndy5 Apr 11, 2024
13989fa
remove obsoleted docs/CSS about customizing code annotations
2bndy5 Apr 11, 2024
373e60f
update announcement banner
2bndy5 Apr 11, 2024
b2f2573
add navigation.footer to docs conf.py features
2bndy5 Apr 11, 2024
e085515
(re-)enable "edit this page" & "view this src" links
2bndy5 Apr 11, 2024
0450970
fix admonitions specific to sphinx and docutils
2bndy5 Apr 11, 2024
b1c2fdc
doc new icon customization options
2bndy5 Apr 11, 2024
986e987
non-intrusively disable search plugin for non-html output
jbms Apr 11, 2024
0ec2674
add info about annotations for block-level elements
2bndy5 Apr 12, 2024
9c57691
admonish copy/no-copy class for code block's copy button
2bndy5 Apr 12, 2024
62a7206
doc content.tooltips feature and enable it in conf.py
2bndy5 Apr 12, 2024
d57ebe7
fix warning about antiquated JS snippet
2bndy5 Apr 12, 2024
7c6ded8
bump mermaid to 10.7.0 (resolves #328)
2bndy5 Apr 12, 2024
dacaa94
update mermaid doc
2bndy5 Apr 12, 2024
71e58e9
reviewed my other commits
2bndy5 Apr 12, 2024
64fa62a
support search-specific meatadata
2bndy5 Jul 4, 2024
f9d0aa6
improve search index for incremental builds
2bndy5 Jul 4, 2024
1f2a86a
fix ruff and mypy config
2bndy5 Oct 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 1 addition & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2016-2022 Martin Donath <[email protected]>
# Copyright (c) 2016-2024 Martin Donath <[email protected]>

# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
Expand Down Expand Up @@ -30,10 +30,6 @@ end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

# Markdown
[*.md]
trim_trailing_whitespace = false

# Python
[*.py]
indent_style = space
Expand Down
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2016-2022 Martin Donath <[email protected]>
# Copyright (c) 2016-2024 Martin Donath <[email protected]>

# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
Expand Down
3 changes: 1 addition & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
],
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-misused-promises": "error",
"@typescript-eslint/no-misused-promises": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-parameter-properties": "off",
"@typescript-eslint/no-floating-promises": "error",
Expand Down Expand Up @@ -320,7 +320,6 @@
}
],
"jsdoc/empty-tags": "warn",
"jsdoc/newline-after-description": "warn",
"jsdoc/no-bad-blocks": "warn",
"jsdoc/no-defaults": "warn",
"jsdoc/no-types": "warn",
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
python-version:
- "3.x"
node-version:
- "16.x"
- '20.x'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -150,7 +150,7 @@ jobs:
- "3.11"
- "3.12"
node-version:
- "16.x"
- '20.x'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .stylelintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2016-2022 Martin Donath <[email protected]>
# Copyright (c) 2016-2024 Martin Donath <[email protected]>

# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
Expand Down
46 changes: 26 additions & 20 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"extends": [
"stylelint-config-rational-order",
"stylelint-config-recess-order",
"stylelint-config-recommended",
"stylelint-config-standard-scss"
"stylelint-config-standard-scss",
"stylelint-stylistic/config"
],
"plugins": [
"stylelint-scss"
Expand Down Expand Up @@ -32,16 +33,6 @@
}
],
"at-rule-no-unknown": null,
"block-closing-brace-newline-after": [
"always",
{
"ignoreAtRules": [
"if",
"else",
"elseif"
]
}
],
"color-function-notation": null,
"color-hex-length": "long",
"color-named": "never",
Expand All @@ -58,23 +49,23 @@
"declaration-colon-space-after": null,
"declaration-no-important": true,
"declaration-block-single-line-max-declarations": 0,
"font-family-name-quotes": "always-where-recommended",
"font-weight-notation": "numeric",
"function-calc-no-unspaced-operator": null,
"function-no-unknown": null,
"function-url-no-scheme-relative": true,
"function-url-quotes": "always",
"font-family-name-quotes": "always-where-recommended",
"font-weight-notation": "numeric",
"hue-degree-notation": "number",
"length-zero-no-unit": [
true,
{
"ignore": ["custom-properties"]
}
],
"linebreaks": "unix",
"media-feature-name-no-unknown": null,
"media-feature-range-notation": null,
"media-query-no-invalid": null,
"no-descending-specificity": null,
"no-empty-first-line": true,
"no-unknown-animations": true,
"property-no-unknown": null,
"property-no-vendor-prefix": [
Expand All @@ -90,19 +81,17 @@
"selector-combinator-space-before": null,
"selector-descendant-combinator-no-non-space": null,
"selector-id-pattern": null,
"selector-max-empty-lines": 0,
"selector-max-id": 0,
"selector-no-qualifying-type": null,
"selector-pseudo-class-no-unknown": null,
"selector-pseudo-element-no-unknown": null,
"string-quotes": "double",
"unicode-bom": "never",
"unit-allowed-list": [
"%",
"ch",
"dppx",
"deg",
"em",
"fr",
"mm",
"ms",
"px",
Expand Down Expand Up @@ -158,6 +147,23 @@
"scss/operator-no-unspaced": true,
"scss/partial-no-import": true,
"scss/percent-placeholder-pattern": "^[a-z][a-z0-9]*(-[a-z0-9]+)*$",
"scss/selector-no-redundant-nesting-selector": true
"scss/selector-no-redundant-nesting-selector": true,
"stylistic/block-closing-brace-newline-after": [
"always",
{
"ignoreAtRules": [
"if",
"else",
"elseif"
]
}
],
"stylistic/declaration-colon-space-after": null,
"stylistic/no-empty-first-line": true,
"stylistic/linebreaks": "unix",
"stylistic/selector-max-empty-lines": 0,
"stylistic/string-quotes": "double",
"stylistic/unicode-bom": "never",
"stylistic/value-list-comma-newline-after": null
}
}
2 changes: 1 addition & 1 deletion MKDOCS_MATERIAL_MERGE_BASE
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f139b54c61b2df4512f15149cba2c222475e2bc9
f27b93ece3c423537873e0bc5de55b3c3381792f
8 changes: 0 additions & 8 deletions docs/_static/extra_css.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@
--md-tooltip-width: 600px;
}

.annotated-with-numbers .md-annotation__index > ::before {
content: attr(data-md-annotation-id);
}

.annotated-with-numbers :focus-within > .md-annotation__index > ::before {
transform: none;
}

/* style for custom font example */
.custom-font-example {
--md-text-font: "Comic Neue";
Expand Down
2 changes: 1 addition & 1 deletion docs/_templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<p>
Now includes
<a href="https://squidfunk.github.io/mkdocs-material/changelog/">changes from mkdocs-material theme</a>
v8.5.6
v9.5.16
</p>
{% endblock %}
177 changes: 177 additions & 0 deletions docs/block_annotations.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@

Block Annotations
=================

The sphinx-immaterial theme has support for adding annotations to block level document elements.
To do this, we will use the :dudir:`class` which is re-exported by sphinx as ``rst-class``.

.. important::

Please read the :dudir:`class` documentation to better understand how Sphinx'
``rst-class`` directive works.

.. seealso::
A special directive is needed to produce :rst:dir:`code-annotations`.

Annotating paragraphs
---------------------

The first block-level element that follows a ``rst-class`` directive (without directive content)
is appended with the ``annotate`` class.

.. rst-example::

.. rst-class:: annotate

An annotated paragraph. (1)

An unannotated paragraph. (2)

1. I'm an annotation! I can contain ``code``, *formatted text*, images, ...
basically anything that can be used. :si-icon:`material/emoticon-happy`
2. This won't show.

When the ``rst-class`` is given content, then all blocks within the content are
appended with the ``annotate`` class.

.. rst-example::

.. rst-class:: annotate

First paragraph (1)

Second paragraph (2)

1. I'm an annotation!
2. I'm an annotation as well!

Annotating lists
----------------

Lists can be annotated as well. Beware that lists are typically started and ended with a blank line.
So, consecutive lists (as in the case of annotating lists) might look odd.

.. rst-example::

.. rst-class:: annotate

1. An ordered list item (1)

1. A nested list does not need to end in a blank line.
2. A second list item (2)

1. I'm an annotation!
2. I'm an annotation as well!

Nested annotations
******************

Nested annotations can be done as well, although the indentation gets tricky.
Beware that the paragraph within the annotated list must also be flagged with
``.. rst-class:: annotate``, otherwise the nested annotation will just appear
as a nested list.

.. rst-example::

.. rst-class:: annotate

Lorem ipsum dolor sit amet, (1) consectetur adipiscing elit.

1. .. rst-class:: annotate

I'm an annotation! (1)

1. I'm an annotation as well!

Annotating admonitions
----------------------

The :rst:dir:`admonition` directives already contain an option to specify CSS classes.
Therefor, we don't need to use the ``rst-class`` directive for admonitions.
Instead, we can just add the ``annotate`` class to the admonition's :rst:`:class:` option.

.. rst-example::

.. note::
:title: Phasellus posuere in sem ut cursus (1)
:class: annotate

Lorem ipsum dolor sit amet, (2) consectetur adipiscing elit. Nulla et
euismod nulla. Curabitur feugiat, tortor non consequat finibus, justo
purus auctor massa, nec semper lorem quam in massa.

1. I'm an annotation!
2. I'm an annotation as well!

Annotating tabbed content
-------------------------

Here is a simple example of `annotating paragraphs`_ within tabbed content
(using :doc:`content_tabs`).

.. rst-example::

.. md-tab-set::

.. md-tab-item:: Tab 1

.. rst-class:: annotate

Lorem ipsum dolor sit amet, (1) consectetur adipiscing elit.

1. I'm an annotation!

.. md-tab-item:: Tab 2

.. rst-class:: annotate

Phasellus posuere in sem ut cursus (1)

1. I'm an annotation as well!

Annotating blockquotes
----------------------

There is a noteworthy clash between the syntax for :duref:`block-quotes` versus the :dudir:`class`.
The suggested workaround is a single rST comment immediately after the ``rst-class`` invocation.

.. rst-example::

.. rst-class:: annotate
..

A blockquote with an annotation. (1)

1. I'm an annotation!

.. info:: Implementation Detail
:collapsible:

The ``rst-class`` directive is not given any content in the example above.
The empty comment :rst:`..` (followed by a blank line) implicitly signifies this to the rST parser.

If we instead provide a blockquote as the sole content to the ``rst-class`` directive,
then indentation is normalized by the rST parser and the blockquote is
interpreted as a simple paragraph.

.. rst-example:: A blockquote as sole directive content *does not work*

.. rst-class:: annotate

A blockquote (normalized to a paragraph) with an annotation. (1)

1. I'm an annotation!

Using a blockquote as subsequent content preserves the indentation needed to satisfy
the :duref:`block-quotes` specification.

.. rst-example:: A blockquote as subsequent directive content *can work*

.. rst-class:: annotate

An annotated paragraph (1) which does not get annotated by the JS implementation.

A blockquote with an annotation. (2)

1. I'm an annotation!
2. I'm an annotation as well!
Loading