Merge branch 'master' into refactor/compatibility

This commit is contained in:
squidfunk 2022-01-09 11:31:50 +01:00
commit ea02f33286
13 changed files with 84 additions and 38 deletions

View File

@ -1,3 +1,8 @@
mkdocs-material-8.1.4+insiders-4.5.2 (2022-01-08)
* Fixed #3440: Content tab indicator not moving when using linking
* Fixed #3445: Content tab switch flickers/jitters when using linking
mkdocs-material-8.1.4+insiders-4.5.1 (2022-01-02)
* Added support for setting initial state of cookie consent

View File

@ -6,6 +6,11 @@ template: overrides/main.html
## Material for MkDocs Insiders
### 4.5.2 <small>_ January 8, 2022</small> { id="4.5.2" }
- Fixed #3440: Content tab indicator not moving when using linking
- Fixed #3445: Content tab switch flickers/jitters when using linking
### 4.5.1 <small>_ January 2, 2022</small> { id="4.5.1" }
- Added support for setting initial state of cookie consent

View File

@ -29,8 +29,8 @@ contents:
name: ci # (1)!
on:
push:
branches: # (2)!
- master
branches:
- master # (2)!
- main
jobs:
deploy:
@ -126,8 +126,8 @@ contents:
image: python:latest
pages:
stage: deploy
only: # (1)!
- master
only:
- master # (1)!
- main
script:
- pip install mkdocs-material

View File

@ -61,7 +61,7 @@ theme:
```
1. :man_raising_hand: I'm a code annotation! I can contain `code`, __formatted
text__, images, ... basically anything that can be expressed in Markdown.
text__, images, ... basically anything that can be written in Markdown.
??? info "Enabling code annotations for a specific code block"
@ -181,7 +181,7 @@ theme:
```
1. :man_raising_hand: I'm a code annotation! I can contain `code`, __formatted
text__, images, ... basically anything that can be expressed in Markdown.
text__, images, ... basically anything that can be written in Markdown.
````
_Result_:
@ -193,7 +193,7 @@ theme:
```
1. :man_raising_hand: I'm a code annotation! I can contain `code`, __formatted
text__, images, ... basically anything that can be expressed in Markdown.
text__, images, ... basically anything that can be written in Markdown.
#### Stripping comments

View File

@ -1,6 +1,6 @@
---
template: overrides/main.html
icon: material/emoticon-wink-outline
icon: material/emoticon-happy-outline
---
# Icons + Emojis

View File

@ -184,7 +184,7 @@
"base": base_url,
"features": features,
"translations": {},
"search": "assets/javascripts/workers/search.c0c1e814.min.js" | url
"search": "assets/javascripts/workers/search.b6ff8c07.min.js" | url
} -%}
{%- if config.extra.version -%}
{%- set _ = app.update({ "version": config.extra.version }) -%}
@ -213,7 +213,7 @@
</script>
{% endblock %}
{% block scripts %}
<script src="{{ 'assets/javascripts/bundle.d85bccd8.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.5e13d264.min.js' | url }}"></script>
{% for path in config["extra_javascript"] %}
<script src="{{ path | url }}"></script>
{% endfor %}

View File

@ -55,7 +55,7 @@ theme:
# - header.autohide
# - navigation.expand
- navigation.indexes
# - navigation.instant
- navigation.instant
- navigation.sections
- navigation.tabs
# - navigation.tabs.sticky

View File

@ -34,7 +34,8 @@ import {
import {
getElement,
getElements
getElements,
getOptionalElement
} from "~/browser"
import { renderAnnotation } from "~/templates"
@ -118,8 +119,10 @@ export function mountAnnotationList(
const annotations = new Map<number, HTMLElement>()
for (const marker of findAnnotationMarkers(container)) {
const [, id] = marker.textContent!.match(/\((\d+)\)/)!
annotations.set(+id, renderAnnotation(+id))
marker.replaceWith(annotations.get(+id)!)
if (getOptionalElement(`li:nth-child(${id})`, el)) {
annotations.set(+id, renderAnnotation(+id))
marker.replaceWith(annotations.get(+id)!)
}
}
/* Keep list if there are no annotations to render */

View File

@ -24,7 +24,7 @@
* Polyfills
* ------------------------------------------------------------------------- */
/* Polyfill for `Object.entries` */
/* Polyfill `Object.entries` */
if (!Object.entries)
Object.entries = function (obj: object) {
const data: [string, string][] = []
@ -36,7 +36,7 @@ if (!Object.entries)
return data
}
/* Polyfill for `Object.values` */
/* Polyfill `Object.values` */
if (!Object.values)
Object.values = function (obj: object) {
const data: string[] = []
@ -48,16 +48,49 @@ if (!Object.values)
return data
}
/* Polyfill for `Element.scrollTo` */
if (typeof Element !== "undefined" && !Element.prototype.scrollTo)
Element.prototype.scrollTo = function (
x?: ScrollToOptions | number, y?: number
): void {
if (typeof x === "object") {
this.scrollLeft = x.left!
this.scrollTop = x.top!
} else {
this.scrollLeft = x!
this.scrollTop = y!
/* ------------------------------------------------------------------------- */
/* Polyfills for `Element` */
if (typeof Element !== "undefined") {
/* Polyfill `Element.scrollTo` */
if (!Element.prototype.scrollTo)
Element.prototype.scrollTo = function (
x?: ScrollToOptions | number, y?: number
): void {
if (typeof x === "object") {
this.scrollLeft = x.left!
this.scrollTop = x.top!
} else {
this.scrollLeft = x!
this.scrollTop = y!
}
}
}
/* Polyfill `Element.replaceWith` */
if (!Element.prototype.replaceWith)
Element.prototype.replaceWith = function (
...nodes: Array<string | Node>
): void {
const parent = this.parentNode
if (parent) {
if (nodes.length === 0)
parent.removeChild(this)
/* Replace children and create text nodes */
for (let i = nodes.length - 1; i >= 0; i--) {
let node = nodes[i]
if (typeof node !== "object")
node = document.createTextNode(node)
else if (node.parentNode)
node.parentNode.removeChild(node)
/* Replace child or insert before previous sibling */
if (!i)
parent.replaceChild(node, this)
else
parent.insertBefore(this.previousSibling!, node)
}
}
}
}