1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-12 01:50:52 +01:00

Fixed highlighted lines in code blocks being cutoff on mobile

This commit is contained in:
squidfunk 2024-04-14 10:38:40 +07:00
parent cd086110bf
commit 9d33f8aaa6
No known key found for this signature in database
GPG Key ID: 5ED40BC4F9C436DF
4 changed files with 15 additions and 6 deletions

View File

@ -249,7 +249,7 @@
</script>
{% endblock %}
{% block scripts %}
<script src="{{ 'assets/javascripts/bundle.b4d6038a.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.ae821067.min.js' | url }}"></script>
{% for script in config.extra_javascript %}
{{ script | script_tag }}
{% endfor %}

View File

@ -42,6 +42,7 @@ import {
import { feature } from "~/_"
import {
getElementContentSize,
getElements,
watchElementSize,
watchElementVisibility
} from "~/browser"
@ -226,6 +227,14 @@ export function mountCodeBlock(
}
}
// If the code block has line spans, we can add this additional class to
// the code block element, which fixes the problem for highlighted code
// lines not stretching to the entirety of the screen when the code block
// overflows, e.g., on mobile - see
const spans = getElements(":scope > span[id]", el)
if (spans.length)
el.classList.add("md-code__content")
/* Create and return component */
return watchCodeBlock(el)
.pipe(