Skip to content

Commit

Permalink
perf: supports configuring code block shrink for each post
Browse files Browse the repository at this point in the history
  • Loading branch information
XPoet committed May 29, 2024
1 parent 5e31bef commit a187c4a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion layout/_page/post.ejs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<%
const post_author = page?.author || theme?.base_info?.author || config?.author
const post_avatar = page?.avatar || theme?.base_info?.avatar
const is_code_block_unshrink = page?.code_block_shrink === false
%>
<div class="fade-in-down-animation">
<div class="post-page-container border-box">
Expand Down Expand Up @@ -50,7 +51,7 @@ const post_avatar = page?.avatar || theme?.base_info?.avatar
</div>
<% } %>
<div class="post-content keep-markdown-body">
<div class="post-content keep-markdown-body <%= is_code_block_unshrink ? 'code-block-unshrink' : '' %>">
<% if (page?.aging === true) { %>
<div class="post-aging-tips"
data-update-date="<%= page.updated %>"
Expand Down
12 changes: 12 additions & 0 deletions source/css/layout/_page/post.styl
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,18 @@ $spacer-padding = 2rem
text-align justify
word-wrap break-word

&.code-block-unshrink {
figure.highlight {
height auto !important
overflow auto !important

.shrink-line {
display none !important
}
}
}


+keep-tablet() {
margin-top calc(var(--component-gap) * 0.6)
padding-bottom calc(var(--component-gap) * 0.6)
Expand Down

0 comments on commit a187c4a

Please sign in to comment.