Skip to content

Commit

Permalink
fix: fix wrap code block line formatter, prevent duplicated id
Browse files Browse the repository at this point in the history
  • Loading branch information
lepture committed Apr 8, 2024
1 parent f5e05b8 commit 626f8de
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
9 changes: 9 additions & 0 deletions src/shibuya/_sphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,12 @@ class WrapLineFormatter(HtmlFormatter):
def __init__(self, **options):
options.setdefault('linespans', 1)
super().__init__(**options)

def _wrap_linespans(self, inner):
i = self.linenostart - 1
for t, line in inner:
if t:
i += 1
yield 1, '<span data-line="%d">%s</span>' % (i, line)
else:
yield 0, line
1 change: 1 addition & 0 deletions src/shibuya/theme/shibuya/components/searchbox.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% include "searchbox.html" %}
2 changes: 1 addition & 1 deletion src/shibuya/theme/shibuya/components/site-head.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{%- endif -%}
</nav>
<div class="sy-head-extra flex items-center print:hidden">
{%- include "searchbox.html" %}
{% include "components/searchbox.html" %}
{% include "components/nav-versions.html" %}
{% include "components/nav-languages.html" %}
<div class="sy-head-social flex items-center">
Expand Down
4 changes: 4 additions & 0 deletions static/css/contents/yue.css
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,10 @@
font-size: 0.9em;
}

.yue kbd {
font-family: var(--sy-f-mono);
}

.yue video {
margin-top: 2em;
margin-bottom: 2em;
Expand Down
2 changes: 1 addition & 1 deletion static/css/variables.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
--sy-f-cjk: PingFang SC, Hiragino Sans GB, Droid Sans Fallback, Microsoft YaHei;
--sy-f-heading: var(--sy-f-sys), var(--sy-f-cjk), sans-serif;
--sy-f-text: var(--sy-f-sys), var(--sy-f-cjk), sans-serif;
--sy-f-mono: Menlo, Monaco, Consolas, "Courier New", monospace;
--sy-f-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
--sy-s-banner-height: 0rem;
--sy-s-navbar-height: 56px;
--sy-s-offset-top: calc(var(--sy-s-navbar-height) + var(--sy-s-banner-height));
Expand Down

0 comments on commit 626f8de

Please sign in to comment.