Skip to content

Commit b61461e

Browse files
committed
Resume the min-width of the tables.
It was lost by mistake while fixing cotes2020#85
1 parent 45e411a commit b61461e

5 files changed

Lines changed: 53 additions & 39 deletions

File tree

_includes/fixlinenos.html

Lines changed: 0 additions & 12 deletions
This file was deleted.

_includes/refactor-content.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!--
2+
Refactor the HTML structure.
3+
-->
4+
5+
{% assign _content = include.content %}
6+
7+
<!--
8+
Suroundding the markdown table with '<div class="table-wrapper">. and '</div>'
9+
-->
10+
{% if _content contains '<table>' %}
11+
{% assign _content = _content | replace: '<table>', '<div class="table-wrapper"><table>' %}
12+
{% assign _content = _content | replace: '</table>', '</table></div>' %}
13+
{% assign _content = _content | replace: '</table></div></code>', '</table></code>' %}
14+
{% endif %}
15+
16+
17+
<!--
18+
Fixed kramdown code highlight rendering:
19+
https://github.com/penibelst/jekyll-compress-html/issues/101
20+
https://github.com/penibelst/jekyll-compress-html/issues/71#issuecomment-188144901
21+
-->
22+
{% if _content contains '<pre class="highlight">' %}
23+
{% assign _content = _content | replace: '<pre class="highlight"><code', '<code' %}
24+
{% assign _content = _content | replace: '</code></pre>', '</code>' %}
25+
{% endif %}
26+
27+
{{ _content }}

_layouts/default.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<div id="main-wrapper">
3737
<div id="main">
3838

39-
{% include fixlinenos.html content=content %}
39+
{% include refactor-content.html content=content %}
4040

4141
{% include footer.html %}
4242

assets/css/_addon/main.scss

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -750,42 +750,41 @@ a {
750750

751751

752752
/*--- Begin of Markdown table style ---*/
753+
div.post-content .table-wrapper {
754+
overflow-x: auto;
753755

754-
div.post-content {
755-
>table, li>table {
756+
>table {
756757
min-width: 60%;
757-
display: block;
758758
overflow-x: auto;
759-
border-collapse: collapse;
760759
border-spacing: 0;
761760
margin-bottom: 1.5rem;
762-
}
763-
}
764761

765-
table {
766-
thead {
767-
border-bottom: solid 2px rgba(210, 215, 217, 0.75);
768-
+tbody tr {
769-
&:nth-child(2n) {
770-
background-color: var(--tb-even-bg);
771-
}
772-
&:nth-child(2n + 1) {
773-
background-color: var(--tb-odd-bg);
762+
thead {
763+
border-bottom: solid 2px rgba(210, 215, 217, 0.75);
764+
th {
765+
@extend %table-cell;
774766
}
775-
& {
776-
border-bottom: 1px solid var(--tb-border-color);
777-
}
778-
}
779-
th {
780-
@extend %table-cell;
781767
}
782-
}
783768

784-
tbody td {
785-
@extend %table-cell;
769+
tbody {
770+
tr {
771+
&:nth-child(2n) {
772+
background-color: var(--tb-even-bg);
773+
}
774+
&:nth-child(2n + 1) {
775+
background-color: var(--tb-odd-bg);
776+
}
777+
& {
778+
border-bottom: 1px solid var(--tb-border-color);
779+
}
780+
td {
781+
@extend %table-cell;
782+
}
783+
}
784+
}
786785
}
786+
}
787787

788-
} // table
789788

790789

791790
/*--- post ---*/

assets/css/_addon/module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
}
1616

1717
%table-cell {
18-
padding: .35rem .8rem;
18+
padding: .4rem 1rem;
1919
font-size: 95%;
2020
}
2121

0 commit comments

Comments
 (0)