mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Merge branch 'master' into refactor/dark-mode
This commit is contained in:
commit
24e35c9fce
21
.github/FUNDING.yml
vendored
Normal file
21
.github/FUNDING.yml
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
# Copyright (c) 2016-2020 Martin Donath <martin.donath@squidfunk.com>
|
||||
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
# IN THE SOFTWARE.
|
||||
|
||||
github: squidfunk
|
5
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
5
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Question
|
||||
url: https://stackoverflow.com
|
||||
about: If you have a question ask it there! All questions on GitHub will be deleted!
|
16
.github/ISSUE_TEMPLATE/question.md
vendored
16
.github/ISSUE_TEMPLATE/question.md
vendored
@ -1,16 +0,0 @@
|
||||
---
|
||||
name: Question
|
||||
about: The issue tracker is not for questions. Please ask your question on StackOverflow.
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
__THE ISSUE TRACKER IS NOT FOR QUESTIONS.__
|
||||
__DO NOT CREATE A NEW ISSUE TO ASK A QUESTION.__
|
||||
|
||||
Please use [StackOverflow][1] to ask your question. If the question is theme-related, you may also use the [official Gitter channel][2]. Issues that
|
||||
only contain questions will be deleted.
|
||||
|
||||
[1]: https://stackoverflow.com
|
||||
[2]: https://gitter.im/squidfunk/mkdocs-material
|
@ -1,3 +1,8 @@
|
||||
mkdocs-material-5.1.7 (2020-05-16)
|
||||
|
||||
* Added keyboard focus support for overflowing code blocks
|
||||
* Fixed #1696: Infinite loop in some cases when using instant loading
|
||||
|
||||
mkdocs-material-5.1.6 (2020-05-09)
|
||||
|
||||
* Added Burmese translations
|
||||
|
@ -54,4 +54,4 @@ EXPOSE 8000
|
||||
|
||||
# Start development server by default
|
||||
ENTRYPOINT ["mkdocs"]
|
||||
CMD ["serve", "--dev-addr=0.0.0.0:8000"]
|
||||
CMD ["serve", "--dev-addr=::0:8000"]
|
||||
|
15
README.md
15
README.md
@ -30,8 +30,8 @@
|
||||
src="https://img.shields.io/pypi/v/mkdocs-material.svg"
|
||||
alt="Python Package Index"
|
||||
/></a>
|
||||
<a href="https://amzn.to/353WRpj"><img
|
||||
src="https://img.shields.io/static/v1?label=amazon&message=wish%20list&color=orange"
|
||||
<a href="https://github.com/sponsors/squidfunk"><img
|
||||
src="https://img.shields.io/static/v1?label=sponsor&message=%E2%9D%A4&logo=GitHub&color=ea4aaa"
|
||||
/></a>
|
||||
</p>
|
||||
|
||||
@ -121,13 +121,16 @@ For other installation methods, configuration options, and a demo, visit
|
||||
[Lyft](https://lyft.github.io/amundsen/),
|
||||
[Netflix](https://netflix.github.io/titus/),
|
||||
[Uber](https://uber.github.io/ludwig/getting_started/),
|
||||
[Salesforce](https://policy-sentry.readthedocs.io/en/latest/),
|
||||
[SAP](https://sap.github.io/ui5-tooling/),
|
||||
[SoundCloud](https://intervene.dev/),
|
||||
[Spotify](https://spotify.github.io/mkdocs-monorepo-plugin/),
|
||||
[Square](https://square.github.io/okhttp/),
|
||||
[Zalando](https://opensource.zalando.com/skipper/)
|
||||
|
||||
* **Open Source** —
|
||||
[AutoKeras](https://autokeras.com/),
|
||||
[BFE](https://www.bfe-networks.net/),
|
||||
[FastAPI](https://fastapi.tiangolo.com/),
|
||||
[OpenFaaS](https://docs.openfaas.com/),
|
||||
[Pi-Hole](https://docs.pi-hole.net/),
|
||||
@ -136,6 +139,14 @@ For other installation methods, configuration options, and a demo, visit
|
||||
[Vapor](https://docs.vapor.codes/),
|
||||
[ZeroNet](https://zeronet.io/docs/)
|
||||
|
||||
## Sponsors
|
||||
|
||||
If you're using this project a lot, consider [sponsoring][2] it! This will give
|
||||
me the opportunity to sustain my efforts maintaining it. Every contribution
|
||||
counts, no matter how small!
|
||||
|
||||
[2]: https://github.com/sponsors/squidfunk
|
||||
|
||||
## License
|
||||
|
||||
**MIT License**
|
||||
|
@ -1,3 +1,7 @@
|
||||
---
|
||||
template: overrides/main.html
|
||||
---
|
||||
|
||||
# License
|
||||
|
||||
**MIT License**
|
||||
|
@ -18,6 +18,11 @@ pip show mkdocs-material
|
||||
|
||||
## Changelog
|
||||
|
||||
### 5.1.7 <small>_ May 16, 2020</small>
|
||||
|
||||
* Added keyboard focus support for overflowing code blocks
|
||||
* Fixed #1696: Infinite loop in some cases when using instant loading
|
||||
|
||||
### 5.1.6 <small>_ May 9, 2020</small>
|
||||
|
||||
* Added Burmese translations
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
material/assets/javascripts/bundle.ff925e8b.min.js.map
Normal file
1
material/assets/javascripts/bundle.ff925e8b.min.js.map
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
material/assets/javascripts/vendor.809e24aa.min.js.map
Normal file
1
material/assets/javascripts/vendor.809e24aa.min.js.map
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,12 +1,12 @@
|
||||
{
|
||||
"assets/javascripts/bundle.js": "assets/javascripts/bundle.8566d47a.min.js",
|
||||
"assets/javascripts/bundle.js.map": "assets/javascripts/bundle.8566d47a.min.js.map",
|
||||
"assets/javascripts/vendor.js": "assets/javascripts/vendor.39a969d5.min.js",
|
||||
"assets/javascripts/vendor.js.map": "assets/javascripts/vendor.39a969d5.min.js.map",
|
||||
"assets/javascripts/worker/search.js": "assets/javascripts/worker/search.37585f48.min.js",
|
||||
"assets/javascripts/worker/search.js.map": "assets/javascripts/worker/search.37585f48.min.js.map",
|
||||
"assets/stylesheets/main.css": "assets/stylesheets/main.e248e4a4.min.css",
|
||||
"assets/stylesheets/main.css.map": "assets/stylesheets/main.e248e4a4.min.css.map",
|
||||
"assets/javascripts/bundle.js": "assets/javascripts/bundle.ff925e8b.min.js",
|
||||
"assets/javascripts/bundle.js.map": "assets/javascripts/bundle.ff925e8b.min.js.map",
|
||||
"assets/javascripts/vendor.js": "assets/javascripts/vendor.809e24aa.min.js",
|
||||
"assets/javascripts/vendor.js.map": "assets/javascripts/vendor.809e24aa.min.js.map",
|
||||
"assets/javascripts/worker/search.js": "assets/javascripts/worker/search.f6ebf1dc.min.js",
|
||||
"assets/javascripts/worker/search.js.map": "assets/javascripts/worker/search.f6ebf1dc.min.js.map",
|
||||
"assets/stylesheets/main.css": "assets/stylesheets/main.0e7a66a4.min.css",
|
||||
"assets/stylesheets/main.css.map": "assets/stylesheets/main.0e7a66a4.min.css.map",
|
||||
"assets/stylesheets/palette.css": "assets/stylesheets/palette.5c06cad9.min.css",
|
||||
"assets/stylesheets/palette.css.map": "assets/stylesheets/palette.5c06cad9.min.css.map"
|
||||
}
|
3
material/assets/stylesheets/main.0e7a66a4.min.css
vendored
Normal file
3
material/assets/stylesheets/main.0e7a66a4.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
material/assets/stylesheets/main.0e7a66a4.min.css.map
Normal file
1
material/assets/stylesheets/main.0e7a66a4.min.css.map
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -29,7 +29,7 @@
|
||||
<meta name="author" content="{{ config.site_author }}">
|
||||
{% endif %}
|
||||
<link rel="shortcut icon" href="{{ config.theme.favicon | url }}">
|
||||
<meta name="generator" content="mkdocs-{{ mkdocs_version }}, mkdocs-material-5.1.6">
|
||||
<meta name="generator" content="mkdocs-{{ mkdocs_version }}, mkdocs-material-5.1.7">
|
||||
{% endblock %}
|
||||
{% block htmltitle %}
|
||||
{% if page and page.meta and page.meta.title %}
|
||||
@ -41,7 +41,7 @@
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block styles %}
|
||||
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.e248e4a4.min.css' | url }}">
|
||||
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.0e7a66a4.min.css' | url }}">
|
||||
{% if palette.primary or palette.accent %}
|
||||
<link rel="stylesheet" href="{{ 'assets/stylesheets/palette.5c06cad9.min.css' | url }}">
|
||||
{% endif %}
|
||||
@ -179,8 +179,8 @@
|
||||
{% endblock %}
|
||||
</div>
|
||||
{% block scripts %}
|
||||
<script src="{{ 'assets/javascripts/vendor.39a969d5.min.js' | url }}"></script>
|
||||
<script src="{{ 'assets/javascripts/bundle.8566d47a.min.js' | url }}"></script>
|
||||
<script src="{{ 'assets/javascripts/vendor.809e24aa.min.js' | url }}"></script>
|
||||
<script src="{{ 'assets/javascripts/bundle.ff925e8b.min.js' | url }}"></script>
|
||||
{%- set translations = {} -%}
|
||||
{%- for key in [
|
||||
"clipboard.copy",
|
||||
@ -204,7 +204,7 @@
|
||||
base: "{{ base_url }}",
|
||||
features: {{ config.theme.features | tojson }},
|
||||
search: Object.assign({
|
||||
worker: "{{ 'assets/javascripts/worker/search.37585f48.min.js' | url }}"
|
||||
worker: "{{ 'assets/javascripts/worker/search.f6ebf1dc.min.js' | url }}"
|
||||
}, typeof search !== "undefined" && search)
|
||||
})
|
||||
</script>
|
||||
|
@ -25,13 +25,13 @@
|
||||
{% endblock %}
|
||||
{% block announce %}
|
||||
<style>.md-announce a,.md-announce a:focus,.md-announce a:hover{color:currentColor}.md-announce strong{white-space:nowrap}.md-announce .twitter{margin-left:.2em;color:#00acee}</style>
|
||||
<a href="https://twitter.com/squidfunk">
|
||||
For updates follow <strong>@squidfunk</strong> on
|
||||
<span class="twemoji twitter">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
||||
<path d="M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299 49.055 0 94.213-16.568 130.274-44.832-46.132-.975-84.792-31.188-98.112-72.772 6.498.974 12.995 1.624 19.818 1.624 9.421 0 18.843-1.3 27.614-3.573-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969 7.797 30.214 12.67 47.431 13.319-28.264-18.843-46.781-51.005-46.781-87.391 0-19.492 5.197-37.36 14.294-52.954 51.655 63.675 129.3 105.258 216.365 109.807-1.624-7.797-2.599-15.918-2.599-24.04 0-57.828 46.782-104.934 104.934-104.934 30.213 0 57.502 12.67 76.67 33.137 23.715-4.548 46.456-13.32 66.599-25.34-7.798 24.366-24.366 44.833-46.132 57.827 21.117-2.273 41.584-8.122 60.426-16.243-14.292 20.791-32.161 39.308-52.628 54.253z"></path>
|
||||
<a href="https://github.com/sponsors/squidfunk">
|
||||
Now accepting sponsorships via <strong>GitHub
|
||||
<span class="twemoji">
|
||||
<svg viewBox="0 2 12 16">
|
||||
<path fill="#ea4aaa" d="M8.727 3C7.091 3 6.001 4.65 6.001 4.65S4.909 3 3.273 3C1.636 3 0 4.1 0 6.3 0 9.6 6 14 6 14s6-4.4 6-7.7C12 4.1 10.364 3 8.727 3z"></path>
|
||||
</svg>
|
||||
</span>
|
||||
<strong>Twitter</strong>
|
||||
Sponsors</strong>!
|
||||
</a>
|
||||
{% endblock %}
|
||||
|
36
package-lock.json
generated
36
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "mkdocs-material",
|
||||
"version": "5.1.6",
|
||||
"version": "5.1.7",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@ -492,9 +492,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "13.13.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.4.tgz",
|
||||
"integrity": "sha512-x26ur3dSXgv5AwKS0lNfbjpCakGIduWU1DU91Zz58ONRWrIKGunmZBNv4P7N+e27sJkiGDsw/3fT4AtsqQBrBA==",
|
||||
"version": "13.13.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.5.tgz",
|
||||
"integrity": "sha512-3ySmiBYJPqgjiHA7oEaIo2Rzz0HrOZ7yrNO5HWyaE5q0lQ3BppDZ3N53Miz8bw2I7gh1/zir2MGVZBvpb1zq9g==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/normalize-package-data": {
|
||||
@ -9251,16 +9251,24 @@
|
||||
}
|
||||
},
|
||||
"stylelint-scss": {
|
||||
"version": "3.17.1",
|
||||
"resolved": "https://registry.npmjs.org/stylelint-scss/-/stylelint-scss-3.17.1.tgz",
|
||||
"integrity": "sha512-KywqqHfK1otZv1QJA4xJDgcPJp1/cP3jnABpbU9gmXOKqKt8cNt27Imsh9JhY133X8D4zDh/38pNq4WjVfUQWQ==",
|
||||
"version": "3.17.2",
|
||||
"resolved": "https://registry.npmjs.org/stylelint-scss/-/stylelint-scss-3.17.2.tgz",
|
||||
"integrity": "sha512-e0dmxqsofy/HZj4urcGSJw4S6yHDJxiQdT20/1ciCsd5lomisa7YM4+Qtt1EG4hsqEG1dbEeF855tec1UyqcSA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"lodash": "^4.17.15",
|
||||
"postcss-media-query-parser": "^0.2.3",
|
||||
"postcss-resolve-nested-selector": "^0.1.1",
|
||||
"postcss-selector-parser": "^6.0.2",
|
||||
"postcss-value-parser": "^4.0.3"
|
||||
"postcss-value-parser": "^4.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"postcss-value-parser": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.1.0.tgz",
|
||||
"integrity": "sha512-97DXOFbQJhk71ne5/Mt6cOu6yxsSfM0QGQyl0L25Gca4yGWEGJaig7l7gbCX623VqTBNGLRLaVUCnNkcedlRSQ==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"sugarss": {
|
||||
@ -9566,9 +9574,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"ts-loader": {
|
||||
"version": "7.0.2",
|
||||
"resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-7.0.2.tgz",
|
||||
"integrity": "sha512-DwpZFB67RoILQHx42dMjSgv2STpacsQu5X+GD/H9ocd8IhU0m8p3b/ZrIln2KmcucC6xep2PdEMEblpWT71euA==",
|
||||
"version": "7.0.4",
|
||||
"resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-7.0.4.tgz",
|
||||
"integrity": "sha512-5du6OQHl+4ZjO4crEyoYUyWSrmmo7bAO+inkaILZ68mvahqrfoa4nn0DRmpQ4ruT4l+cuJCgF0xD7SBIyLeeow==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"chalk": "^2.3.0",
|
||||
@ -9629,9 +9637,9 @@
|
||||
}
|
||||
},
|
||||
"tslib": {
|
||||
"version": "1.11.1",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz",
|
||||
"integrity": "sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA=="
|
||||
"version": "1.11.2",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.2.tgz",
|
||||
"integrity": "sha512-tTSkux6IGPnUGUd1XAZHcpu85MOkIl5zX49pO+jfsie3eP0B6pyhOlLXm3cAC6T7s+euSDDUUV+Acop5WmtkVg=="
|
||||
},
|
||||
"tslint": {
|
||||
"version": "5.20.1",
|
||||
|
10
package.json
10
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "mkdocs-material",
|
||||
"version": "5.1.6",
|
||||
"version": "5.1.7",
|
||||
"description": "A Material Design theme for MkDocs",
|
||||
"keywords": [
|
||||
"mkdocs",
|
||||
@ -50,7 +50,7 @@
|
||||
"@types/html-minifier": "^3.5.3",
|
||||
"@types/lunr": "^2.3.3",
|
||||
"@types/mini-css-extract-plugin": "^0.9.1",
|
||||
"@types/node": "^13.13.4",
|
||||
"@types/node": "^13.13.5",
|
||||
"@types/ramda": "^0.27.4",
|
||||
"@types/resize-observer-browser": "^0.1.3",
|
||||
"@types/webpack": "^4.41.12",
|
||||
@ -81,11 +81,11 @@
|
||||
"stylelint-config-rational-order": "^0.1.2",
|
||||
"stylelint-config-standard": "^20.0.0",
|
||||
"stylelint-order": "^4.0.0",
|
||||
"stylelint-scss": "^3.17.1",
|
||||
"ts-loader": "^7.0.2",
|
||||
"stylelint-scss": "^3.17.2",
|
||||
"ts-loader": "^7.0.4",
|
||||
"ts-node": "^8.10.1",
|
||||
"tsconfig-paths-webpack-plugin": "^3.2.0",
|
||||
"tslib": "^1.11.1",
|
||||
"tslib": "^1.11.2",
|
||||
"tslint": "^5.20.1",
|
||||
"tslint-sonarts": "^1.9.0",
|
||||
"typescript": "^3.8.3",
|
||||
|
@ -23,4 +23,4 @@ mkdocs>=1.1
|
||||
Pygments>=2.4
|
||||
markdown>=3.2
|
||||
pymdown-extensions>=7.0
|
||||
mkdocs-material-extensions>=1.0b1
|
||||
mkdocs-material-extensions>=1.0
|
||||
|
@ -86,6 +86,7 @@ import {
|
||||
SearchIndex
|
||||
} from "integrations"
|
||||
import {
|
||||
patchCodeBlocks,
|
||||
patchTables,
|
||||
patchDetails,
|
||||
patchScrollfix,
|
||||
@ -178,6 +179,7 @@ export function initialize(config: unknown) {
|
||||
|
||||
const keyboard$ = setupKeyboard()
|
||||
|
||||
patchCodeBlocks({ document$, viewport$ })
|
||||
patchDetails({ document$, hash$ })
|
||||
patchScripts({ document$ })
|
||||
patchSource({ document$ })
|
||||
@ -383,6 +385,9 @@ export function initialize(config: unknown) {
|
||||
|
||||
/* Determine common prefix */
|
||||
let index = 0
|
||||
if (a === b)
|
||||
index = a.length
|
||||
else
|
||||
while (a.charAt(index) === b.charAt(index))
|
||||
index++
|
||||
|
||||
|
76
src/assets/javascripts/patches/code/index.ts
Normal file
76
src/assets/javascripts/patches/code/index.ts
Normal file
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2020 Martin Donath <martin.donath@squidfunk.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import { Observable, combineLatest } from "rxjs"
|
||||
import { distinctUntilKeyChanged, map } from "rxjs/operators"
|
||||
|
||||
import { Viewport, getElements } from "browser"
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Helper types
|
||||
* ------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Mount options
|
||||
*/
|
||||
interface MountOptions {
|
||||
document$: Observable<Document> /* Document observable */
|
||||
viewport$: Observable<Viewport> /* Viewport observable */
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Functions
|
||||
* ------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Patch all `code` elements
|
||||
*
|
||||
* This function will make overflowing code blocks focusable via keyboard, so
|
||||
* they can be scrolled without a mouse.
|
||||
*
|
||||
* @param options - Options
|
||||
*/
|
||||
export function patchCodeBlocks(
|
||||
{ document$, viewport$ }: MountOptions
|
||||
): void {
|
||||
const els$ = document$
|
||||
.pipe(
|
||||
map(() => getElements<HTMLTableElement>("pre > code"))
|
||||
)
|
||||
|
||||
/* Observe viewport size only */
|
||||
const size$ = viewport$
|
||||
.pipe(
|
||||
distinctUntilKeyChanged("size")
|
||||
)
|
||||
|
||||
/* Make overflowing elements focusable */
|
||||
combineLatest([els$, size$])
|
||||
.subscribe(([els]) => {
|
||||
for (const el of els) {
|
||||
if (el.scrollWidth > el.clientWidth)
|
||||
el.setAttribute("tabindex", "0")
|
||||
else
|
||||
el.removeAttribute("tabindex")
|
||||
}
|
||||
})
|
||||
}
|
@ -20,6 +20,7 @@
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
export * from "./code"
|
||||
export * from "./details"
|
||||
export * from "./script"
|
||||
export * from "./scrollfix"
|
||||
|
@ -205,6 +205,7 @@ kbd {
|
||||
box-shadow: none;
|
||||
box-decoration-break: slice;
|
||||
touch-action: auto;
|
||||
scrollbar-width: thin;
|
||||
|
||||
// Override native scrollbar styles
|
||||
&::-webkit-scrollbar {
|
||||
|
@ -52,7 +52,7 @@ $admonitions: (
|
||||
$name: nth($names, 1);
|
||||
$icon: nth($props, 1);
|
||||
|
||||
// Inline icon through string-replace-loader in webpack
|
||||
// Inline icon through postcss in webpack
|
||||
--md-admonition-icon--#{$name}: svg-load("@mdi/svg/svg/#{$icon}.svg");
|
||||
}
|
||||
}
|
||||
|
@ -75,13 +75,13 @@
|
||||
color: #00acee;
|
||||
}
|
||||
</style>
|
||||
<a href="https://twitter.com/squidfunk">
|
||||
For updates follow <strong>@squidfunk</strong> on
|
||||
<span class="twemoji twitter">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
||||
<path d="M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299 49.055 0 94.213-16.568 130.274-44.832-46.132-.975-84.792-31.188-98.112-72.772 6.498.974 12.995 1.624 19.818 1.624 9.421 0 18.843-1.3 27.614-3.573-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969 7.797 30.214 12.67 47.431 13.319-28.264-18.843-46.781-51.005-46.781-87.391 0-19.492 5.197-37.36 14.294-52.954 51.655 63.675 129.3 105.258 216.365 109.807-1.624-7.797-2.599-15.918-2.599-24.04 0-57.828 46.782-104.934 104.934-104.934 30.213 0 57.502 12.67 76.67 33.137 23.715-4.548 46.456-13.32 66.599-25.34-7.798 24.366-24.366 44.833-46.132 57.827 21.117-2.273 41.584-8.122 60.426-16.243-14.292 20.791-32.161 39.308-52.628 54.253z"></path>
|
||||
<a href="https://github.com/sponsors/squidfunk">
|
||||
Now accepting sponsorships via <strong>GitHub
|
||||
<span class="twemoji">
|
||||
<svg viewBox="0 2 12 16">
|
||||
<path fill="#ea4aaa" d="M8.727 3C7.091 3 6.001 4.65 6.001 4.65S4.909 3 3.273 3C1.636 3 0 4.1 0 6.3 0 9.6 6 14 6 14s6-4.4 6-7.7C12 4.1 10.364 3 8.727 3z"></path>
|
||||
</svg>
|
||||
</span>
|
||||
<strong>Twitter</strong>
|
||||
Sponsors</strong>!
|
||||
</a>
|
||||
{% endblock %}
|
||||
|
Loading…
Reference in New Issue
Block a user