Skip to content

Commit

Permalink
Resume the min-width of the tables.
Browse files Browse the repository at this point in the history
It was lost by mistake while fixing barryclark#85
  • Loading branch information
cotes2020 committed Aug 14, 2020
1 parent 0809e2b commit 188d8ff
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 39 deletions.
12 changes: 0 additions & 12 deletions _includes/fixlinenos.html

This file was deleted.

27 changes: 27 additions & 0 deletions _includes/refactor-content.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!--
Refactor the HTML structure.
-->

{% assign _content = include.content %}

<!--
Suroundding the markdown table with '<div class="table-wrapper">. and '</div>'
-->
{% if _content contains '<table>' %}
{% assign _content = _content | replace: '<table>', '<div class="table-wrapper"><table>' %}
{% assign _content = _content | replace: '</table>', '</table></div>' %}
{% assign _content = _content | replace: '</table></div></code>', '</table></code>' %}
{% endif %}


<!--
Fixed kramdown code highlight rendering:
https://github.com/penibelst/jekyll-compress-html/issues/101
https://github.com/penibelst/jekyll-compress-html/issues/71#issuecomment-188144901
-->
{% if _content contains '<pre class="highlight">' %}
{% assign _content = _content | replace: '<pre class="highlight"><code', '<code' %}
{% assign _content = _content | replace: '</code></pre>', '</code>' %}
{% endif %}

{{ _content }}
2 changes: 1 addition & 1 deletion _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<div id="main-wrapper">
<div id="main">

{% include fixlinenos.html content=content %}
{% include refactor-content.html content=content %}

{% include footer.html %}

Expand Down
49 changes: 24 additions & 25 deletions assets/css/_addon/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -750,42 +750,41 @@ a {


/*--- Begin of Markdown table style ---*/
div.post-content .table-wrapper {
overflow-x: auto;

div.post-content {
>table, li>table {
>table {
min-width: 60%;
display: block;
overflow-x: auto;
border-collapse: collapse;
border-spacing: 0;
margin-bottom: 1.5rem;
}
}

table {
thead {
border-bottom: solid 2px rgba(210, 215, 217, 0.75);
+tbody tr {
&:nth-child(2n) {
background-color: var(--tb-even-bg);
}
&:nth-child(2n + 1) {
background-color: var(--tb-odd-bg);
thead {
border-bottom: solid 2px rgba(210, 215, 217, 0.75);
th {
@extend %table-cell;
}
& {
border-bottom: 1px solid var(--tb-border-color);
}
}
th {
@extend %table-cell;
}
}

tbody td {
@extend %table-cell;
tbody {
tr {
&:nth-child(2n) {
background-color: var(--tb-even-bg);
}
&:nth-child(2n + 1) {
background-color: var(--tb-odd-bg);
}
& {
border-bottom: 1px solid var(--tb-border-color);
}
td {
@extend %table-cell;
}
}
}
}
}

} // table


/*--- post ---*/
Expand Down
2 changes: 1 addition & 1 deletion assets/css/_addon/module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}

%table-cell {
padding: .35rem .8rem;
padding: .4rem 1rem;
font-size: 95%;
}

Expand Down

0 comments on commit 188d8ff

Please sign in to comment.