Skip to content
Snippets Groups Projects
Commit 1949d793 authored by Quoc Huy Nguyen Dinh's avatar Quoc Huy Nguyen Dinh
Browse files

- responsive tables

- table odd/even row background color
- table borders
parent cd11da05
No related branches found
No related tags found
2 merge requests!358- responsive tables,!357Better HTML Table handling
......@@ -94,12 +94,21 @@ hr {
table {
box-shadow: inset 0 0 0 -1px red;
font-size: 1.02rem;
}
table td, table th {
border: 1px dotted rgba(128, 128, 128, 0.1);
}
tbody th, tbody td {
padding: 0.25rem 0.4rem;
}
thead, tbody, tfoot {
@include themify($themes) {
background-color: themed('backgroundColor');
background-color: themed('tableRowOddBackgroundColor');
border: themed('borderLight');
}
}
......@@ -110,6 +119,10 @@ thead {
}
}
thead th {
white-space: nowrap;
}
tbody tr:nth-child(even) {
@include themify($themes) {
background-color: themed('tableRowEvenBackgroundColor');
......
......@@ -10,6 +10,7 @@ import tt from 'counterpart';
import { generateMd as EmbeddedPlayerGenerateMd } from 'app/components/elements/EmbeddedPlayers';
import RemarkableSpoiler from '@quochuync/remarkable-spoiler';
import '@quochuync/remarkable-spoiler/styles.css';
import RemarkableTable from "app/utils/RemarkableTable";
class MarkdownViewer extends Component {
static propTypes = {
......@@ -80,6 +81,7 @@ class MarkdownViewer extends Component {
});
renderer.use(RemarkableSpoiler);
renderer.use(RemarkableTable);
let renderedText = html ? text : renderer.render(text);
......
......@@ -284,3 +284,7 @@ input.share-box {
font-size: .8em;
}
}
.table-responsive {
overflow-x: auto;
}
/** Removes all markdown leaving just plain text */
const remarkableTable = (md) => {
md.renderer.rules.table_open = () => {
return '<div class="table-responsive"><table>\n';
};
md.renderer.rules.table_close = () => {
return '</table></div>\n';
};
};
export default remarkableTable;
......@@ -127,6 +127,7 @@ export default ({
'redditWrapper',
'tweetWrapper',
'phishy',
'table-responsive',
];
const validClass = classWhitelist.find((e) => attribs.class == e);
if (validClass) attys.class = validClass;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment