mirror of
https://github.com/tcsenpai/obsidiangarden_netlify.git
synced 2025-06-06 20:55:21 +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 calloutType = "";
|
||||||
let isCollapsable;
|
let isCollapsable;
|
||||||
let isCollapsed;
|
let isCollapsed;
|
||||||
const calloutMeta = /\[!([\w-]*)\](\+|\-){0,1}(\s?.*)/;;
|
const calloutMeta = /\[!([\w-]*)\](\+|\-){0,1}(\s?.*)/;
|
||||||
if (!content.match(calloutMeta)) {
|
if (!content.match(calloutMeta)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -293,6 +293,17 @@ module.exports = function (eleventyConfig) {
|
|||||||
return str && parsed.innerHTML;
|
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) => {
|
eleventyConfig.addTransform("htmlMinifier", (content, outputPath) => {
|
||||||
if (
|
if (
|
||||||
process.env.NODE_ENV === "production" &&
|
process.env.NODE_ENV === "production" &&
|
||||||
@ -322,12 +333,12 @@ module.exports = function (eleventyConfig) {
|
|||||||
eleventyConfig.addPlugin(pluginRss, {
|
eleventyConfig.addPlugin(pluginRss, {
|
||||||
posthtmlRenderOptions: {
|
posthtmlRenderOptions: {
|
||||||
closingSingleTag: "slash",
|
closingSingleTag: "slash",
|
||||||
singleTags: ["link"]
|
singleTags: ["link"],
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
eleventyConfig.addFilter("dateToZulu", function(date){
|
eleventyConfig.addFilter("dateToZulu", function (date) {
|
||||||
if(!date) return "";
|
if (!date) return "";
|
||||||
return new Date(date).toISOString("dd-MM-yyyyTHH:mm:ssZ");
|
return new Date(date).toISOString("dd-MM-yyyyTHH:mm:ssZ");
|
||||||
});
|
});
|
||||||
eleventyConfig.addFilter("jsonify", function (variable) {
|
eleventyConfig.addFilter("jsonify", function (variable) {
|
||||||
|
@ -740,9 +740,14 @@ body.backlinks-note-icon .backlink[data-note-icon="3"]::before {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.align-icon {
|
.align-icon {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-evenly;
|
justify-content: space-evenly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.cm-s-obsidian {
|
||||||
|
.table-wrapper {
|
||||||
|
overflow-x: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user