Skip to content

Commit b33c461

Browse files
authored
Merge pull request #271 from dotkernel/article-status
fixed narrow tables
2 parents 8c69d22 + 5c4f24c commit b33c461

3 files changed

Lines changed: 11 additions & 8 deletions

File tree

‎public/css/app.css‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/App/assets/scss/components/_blog.scss‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,18 +242,21 @@ $bp-tablet: 900px;
242242
}
243243

244244
// Markdown tables render as bare <table> elements, so they are styled by tag.
245-
// display:block lets a wide table scroll sideways instead of overflowing the column.
246-
table {
247-
display: block;
248-
width: 100%;
249-
max-width: 100%;
245+
// The template wraps each one in .table-wrap so a wide table scrolls sideways
246+
// instead of overflowing the column.
247+
.table-wrap {
250248
margin: 0 0 24px;
251249
overflow-x: auto;
252250
border: 1px solid var(--border);
253251
border-radius: 8px;
252+
background: var(--surface);
253+
}
254+
255+
table {
256+
width: 100%;
257+
margin: 0;
254258
border-collapse: collapse;
255259
font-size: 14.5px;
256-
background: var(--surface);
257260

258261
th,
259262
td {

‎src/Blog/templates/page/markdown-article.html.twig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{% extends '@layout/blog-post.html.twig' %}
22

33
{% block body %}
4-
{{ content|markdown_to_html }}
4+
{{ content|markdown_to_html|replace({'<table>': '<div class="table-wrap"><table>', '</table>': '</table></div>'})|raw }}
55

66
{% if faq is not empty %}
77
<h2 id="user-content-faq">Frequently Asked Questions</h2>

0 commit comments

Comments
 (0)