mirror of
https://github.com/tcsenpai/obsidiangarden_netlify.git
synced 2025-06-04 12:00:02 +00:00
Table wrapper for markdown tables (#114)
* table wrapper for markdown tables * minimal formatting * minimal formatting * Only show scroll when neccessary --------- Co-authored-by: Ole Eskild Steensen <oleeskild@users.noreply.github.com>
This commit is contained in:
parent
b44de6e0f8
commit
23d2d7c7ff
21
.eleventy.js
21
.eleventy.js
@ -254,7 +254,7 @@ module.exports = function (eleventyConfig) {
|
||||
let calloutType = "";
|
||||
let isCollapsable;
|
||||
let isCollapsed;
|
||||
const calloutMeta = /\[!([\w-]*)\](\+|\-){0,1}(\s?.*)/;;
|
||||
const calloutMeta = /\[!([\w-]*)\](\+|\-){0,1}(\s?.*)/;
|
||||
if (!content.match(calloutMeta)) {
|
||||
continue;
|
||||
}
|
||||
@ -293,6 +293,17 @@ module.exports = function (eleventyConfig) {
|
||||
return str && parsed.innerHTML;
|
||||
});
|
||||
|
||||
eleventyConfig.addTransform("table", function (str) {
|
||||
const parsed = parse(str);
|
||||
for (const t of parsed.querySelectorAll(".cm-s-obsidian > table")) {
|
||||
let inner = t.innerHTML;
|
||||
t.tagName = "div";
|
||||
t.classList.add("table-wrapper");
|
||||
t.innerHTML = `<table>${inner}</table>`;
|
||||
}
|
||||
return str && parsed.innerHTML;
|
||||
});
|
||||
|
||||
eleventyConfig.addTransform("htmlMinifier", (content, outputPath) => {
|
||||
if (
|
||||
process.env.NODE_ENV === "production" &&
|
||||
@ -322,12 +333,12 @@ module.exports = function (eleventyConfig) {
|
||||
eleventyConfig.addPlugin(pluginRss, {
|
||||
posthtmlRenderOptions: {
|
||||
closingSingleTag: "slash",
|
||||
singleTags: ["link"]
|
||||
}
|
||||
singleTags: ["link"],
|
||||
},
|
||||
});
|
||||
|
||||
eleventyConfig.addFilter("dateToZulu", function(date){
|
||||
if(!date) return "";
|
||||
eleventyConfig.addFilter("dateToZulu", function (date) {
|
||||
if (!date) return "";
|
||||
return new Date(date).toISOString("dd-MM-yyyyTHH:mm:ssZ");
|
||||
});
|
||||
eleventyConfig.addFilter("jsonify", function (variable) {
|
||||
|
@ -517,7 +517,7 @@ ul.task-list {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-width: 150px;
|
||||
margin: 10px 40px;
|
||||
margin: 10px 40px;
|
||||
border: 1px solid var(--text-normal);
|
||||
cursor: pointer;
|
||||
|
||||
@ -740,9 +740,14 @@ body.backlinks-note-icon .backlink[data-note-icon="3"]::before {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.align-icon {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: space-evenly;
|
||||
}
|
||||
}
|
||||
|
||||
.cm-s-obsidian {
|
||||
.table-wrapper {
|
||||
overflow-x: auto;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user