feat: port charts, mermaid, math, markmap, copy, pager to Tailwind

This commit is contained in:
George Cushen committed 2023-10-27 20:29:18 +01:00
1 parent 45a7ac7b41
commit 49690f2ae1
89 files changed
+5946 -77

No files matched your search

@@ -1,2 +1,3 @@
@import "page.css";
@import "task-list.css";
@import "copy.css";
@@ -0,0 +1,28 @@
/* Code Copy */
/* Hugo's Code Block Wrapper Class */
.highlight {
@apply relative z-0;
}
.highlight:hover > .copy-button {
@apply visible;
}
/* Copy Button */
.copy-button {
@apply invisible absolute right-0 top-0 z-10 w-20 py-1
cursor-pointer font-mono text-sm whitespace-nowrap
rounded-bl-md rounded-tr-md
bg-neutral-200 text-neutral-700 opacity-90
dark:bg-neutral-600 dark:text-neutral-200;
}
.copy-button:hover,
.copy-button:focus,
.copy-button:active,
.copy-button:active:hover {
@apply bg-primary-100 dark:bg-primary-600;
}
@@ -12,7 +12,7 @@
--color-neutral-700: 51, 65, 85;
--color-neutral-800: 30, 41, 59;
--color-neutral-900: 15, 23, 42;
/* Primary */
/* TW Blue Palette */
--color-primary-50: 239, 246, 255;
--color-primary-100: 219, 234, 254;
--color-primary-200: 191, 219, 254;
@@ -23,4 +23,15 @@
--color-primary-700: 29, 78, 216;
--color-primary-800: 30, 64, 175;
--color-primary-900: 30, 58, 138;
/* TW Cyan Palette */
--color-secondary-50: 236, 254, 255;
--color-secondary-100: 207, 250, 254;
--color-secondary-200: 165, 243, 252;
--color-secondary-300: 103, 232, 249;
--color-secondary-400: 34, 211, 238;
--color-secondary-500: 6, 182, 212;
--color-secondary-600: 8, 145, 178;
--color-secondary-700: 14, 116, 144;
--color-secondary-800: 21, 94, 117;
--color-secondary-900: 22, 78, 99;
}
@@ -0,0 +1 @@
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("katex")):"function"==typeof define&&define.amd?define(["katex"],t):"object"==typeof exports?exports.renderMathInElement=t(require("katex")):e.renderMathInElement=t(e.katex)}("undefined"!=typeof self?self:this,(function(e){return function(){"use strict";var t={771:function(t){t.exports=e}},r={};function n(e){var i=r[e];if(void 0!==i)return i.exports;var a=r[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var i={};return function(){n.d(i,{default:function(){return s}});var e=n(771),t=n.n(e),r=function(e,t,r){for(var n=r,i=0,a=e.length;n<t.length;){var o=t[n];if(i<=0&&t.slice(n,n+a)===e)return n;"\\"===o?n++:"{"===o?i++:"}"===o&&i--,n++}return-1},a=/^\\begin{/,o=function(e,t){for(var n,i=[],o=new RegExp("("+t.map((function(e){return e.left.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")})).join("|")+")");-1!==(n=e.search(o));){n>0&&(i.push({type:"text",data:e.slice(0,n)}),e=e.slice(n));var l=t.findIndex((function(t){return e.startsWith(t.left)}));if(-1===(n=r(t[l].right,e,t[l].left.length)))break;var d=e.slice(0,n+t[l].right.length),s=a.test(d)?d:e.slice(t[l].left.length,n);i.push({type:"math",data:s,rawData:d,display:t[l].display}),e=e.slice(n+t[l].right.length)}return""!==e&&i.push({type:"text",data:e}),i},l=function(e,r){var n=o(e,r.delimiters);if(1===n.length&&"text"===n[0].type)return null;for(var i=document.createDocumentFragment(),a=0;a<n.length;a++)if("text"===n[a].type)i.appendChild(document.createTextNode(n[a].data));else{var l=document.createElement("span"),d=n[a].data;r.displayMode=n[a].display;try{r.preProcess&&(d=r.preProcess(d)),t().render(d,l,r)}catch(e){if(!(e instanceof t().ParseError))throw e;r.errorCallback("KaTeX auto-render: Failed to parse `"+n[a].data+"` with ",e),i.appendChild(document.createTextNode(n[a].rawData));continue}i.appendChild(l)}return i},d=function e(t,r){for(var n=0;n<t.childNodes.length;n++){var i=t.childNodes[n];if(3===i.nodeType){for(var a=i.textContent,o=i.nextSibling,d=0;o&&o.nodeType===Node.TEXT_NODE;)a+=o.textContent,o=o.nextSibling,d++;var s=l(a,r);if(s){for(var f=0;f<d;f++)i.nextSibling.remove();n+=s.childNodes.length-1,t.replaceChild(s,i)}else n+=d}else 1===i.nodeType&&function(){var t=" "+i.className+" ";-1===r.ignoredTags.indexOf(i.nodeName.toLowerCase())&&r.ignoredClasses.every((function(e){return-1===t.indexOf(" "+e+" ")}))&&e(i,r)}()}},s=function(e,t){if(!e)throw new Error("No element provided to render");var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]=t[n]);r.delimiters=r.delimiters||[{left:"$$",right:"$$",display:!0},{left:"\\(",right:"\\)",display:!1},{left:"\\begin{equation}",right:"\\end{equation}",display:!0},{left:"\\begin{align}",right:"\\end{align}",display:!0},{left:"\\begin{alignat}",right:"\\end{alignat}",display:!0},{left:"\\begin{gather}",right:"\\end{gather}",display:!0},{left:"\\begin{CD}",right:"\\end{CD}",display:!0},{left:"\\[",right:"\\]",display:!0}],r.ignoredTags=r.ignoredTags||["script","noscript","style","textarea","pre","code","option"],r.ignoredClasses=r.ignoredClasses||[],r.errorCallback=r.errorCallback||console.error,r.macros=r.macros||{},d(e,r)}}(),i=i.default}()}));
@@ -0,0 +1 @@
@font-face{font-family:KaTeX_AMS;font-style:normal;font-weight:400;src:url(fonts/KaTeX_AMS-Regular.woff2) format("woff2"),url(fonts/KaTeX_AMS-Regular.woff) format("woff"),url(fonts/KaTeX_AMS-Regular.ttf) format("truetype")}@font-face{font-family:KaTeX_Caligraphic;font-style:normal;font-weight:700;src:url(fonts/KaTeX_Caligraphic-Bold.woff2) format("woff2"),url(fonts/KaTeX_Caligraphic-Bold.woff) format("woff"),url(fonts/KaTeX_Caligraphic-Bold.ttf) format("truetype")}@font-face{font-family:KaTeX_Caligraphic;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Caligraphic-Regular.woff2) format("woff2"),url(fonts/KaTeX_Caligraphic-Regular.woff) format("woff"),url(fonts/KaTeX_Caligraphic-Regular.ttf) format("truetype")}@font-face{font-family:KaTeX_Fraktur;font-style:normal;font-weight:700;src:url(fonts/KaTeX_Fraktur-Bold.woff2) format("woff2"),url(fonts/KaTeX_Fraktur-Bold.woff) format("woff"),url(fonts/KaTeX_Fraktur-Bold.ttf) format("truetype")}@font-face{font-family:KaTeX_Fraktur;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Fraktur-Regular.woff2) format("woff2"),url(fonts/KaTeX_Fraktur-Regular.woff) format("woff"),url(fonts/KaTeX_Fraktur-Regular.ttf) format("truetype")}@font-face{font-family:KaTeX_Main;font-style:normal;font-weight:700;src:url(fonts/KaTeX_Main-Bold.woff2) format("woff2"),url(fonts/KaTeX_Main-Bold.woff) format("woff"),url(fonts/KaTeX_Main-Bold.ttf) format("truetype")}@font-face{font-family:KaTeX_Main;font-style:italic;font-weight:700;src:url(fonts/KaTeX_Main-BoldItalic.woff2) format("woff2"),url(fonts/KaTeX_Main-BoldItalic.woff) format("woff"),url(fonts/KaTeX_Main-BoldItalic.ttf) format("truetype")}@font-face{font-family:KaTeX_Main;font-style:italic;font-weight:400;src:url(fonts/KaTeX_Main-Italic.woff2) format("woff2"),url(fonts/KaTeX_Main-Italic.woff) format("woff"),url(fonts/KaTeX_Main-Italic.ttf) format("truetype")}@font-face{font-family:KaTeX_Main;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Main-Regular.woff2) format("woff2"),url(fonts/KaTeX_Main-Regular.woff) format("woff"),url(fonts/KaTeX_Main-Regular.ttf) format("truetype")}@font-face{font-family:KaTeX_Math;font-style:italic;font-weight:700;src:url(fonts/KaTeX_Math-BoldItalic.woff2) format("woff2"),url(fonts/KaTeX_Math-BoldItalic.woff) format("woff"),url(fonts/KaTeX_Math-BoldItalic.ttf) format("truetype")}@font-face{font-family:KaTeX_Math;font-style:italic;font-weight:400;src:url(fonts/KaTeX_Math-Italic.woff2) format("woff2"),url(fonts/KaTeX_Math-Italic.woff) format("woff"),url(fonts/KaTeX_Math-Italic.ttf) format("truetype")}@font-face{font-family:"KaTeX_SansSerif";font-style:normal;font-weight:700;src:url(fonts/KaTeX_SansSerif-Bold.woff2) format("woff2"),url(fonts/KaTeX_SansSerif-Bold.woff) format("woff"),url(fonts/KaTeX_SansSerif-Bold.ttf) format("truetype")}@font-face{font-family:"KaTeX_SansSerif";font-style:italic;font-weight:400;src:url(fonts/KaTeX_SansSerif-Italic.woff2) format("woff2"),url(fonts/KaTeX_SansSerif-Italic.woff) format("woff"),url(fonts/KaTeX_SansSerif-Italic.ttf) format("truetype")}@font-face{font-family:"KaTeX_SansSerif";font-style:normal;font-weight:400;src:url(fonts/KaTeX_SansSerif-Regular.woff2) format("woff2"),url(fonts/KaTeX_SansSerif-Regular.woff) format("woff"),url(fonts/KaTeX_SansSerif-Regular.ttf) format("truetype")}@font-face{font-family:KaTeX_Script;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Script-Regular.woff2) format("woff2"),url(fonts/KaTeX_Script-Regular.woff) format("woff"),url(fonts/KaTeX_Script-Regular.ttf) format("truetype")}@font-face{font-family:KaTeX_Size1;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Size1-Regular.woff2) format("woff2"),url(fonts/KaTeX_Size1-Regular.woff) format("woff"),url(fonts/KaTeX_Size1-Regular.ttf) format("truetype")}@font-face{font-family:KaTeX_Size2;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Size2-Regular.woff2) format("woff2"),url(fonts/KaTeX_Size2-Regular.woff) format("woff"),url(fonts/KaTeX_Size2-Regular.ttf) format("truetype")}@font-face{font-family:KaTeX_Size3;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Size3-Regular.woff2) format("woff2"),url(fonts/KaTeX_Size3-Regular.woff) format("woff"),url(fonts/KaTeX_Size3-Regular.ttf) format("truetype")}@font-face{font-family:KaTeX_Size4;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Size4-Regular.woff2) format("woff2"),url(fonts/KaTeX_Size4-Regular.woff) format("woff"),url(fonts/KaTeX_Size4-Regular.ttf) format("truetype")}@font-face{font-family:KaTeX_Typewriter;font-style:normal;font-weight:400;src:url(fonts/KaTeX_Typewriter-Regular.woff2) format("woff2"),url(fonts/KaTeX_Typewriter-Regular.woff) format("woff"),url(fonts/KaTeX_Typewriter-Regular.ttf) format("truetype")}.katex{text-rendering:auto;font:normal 1.21em KaTeX_Main,Times New Roman,serif;line-height:1.2;text-indent:0}.katex *{-ms-high-contrast-adjust:none!important;border-color:currentColor}.katex .katex-version:after{content:"0.16.9"}.katex .katex-mathml{clip:rect(1px,1px,1px,1px);border:0;height:1pxLine truncated
@@ -0,0 +1 @@
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.katex=t():e.katex=t()}("undefined"!=typeof self?self:this,(function(){return function(){"use strict";var e={d:function(t,r){for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t={};e.d(t,{default:function(){return na}});var r=function e(t,r){this.name=void 0,this.position=void 0,this.length=void 0,this.rawMessage=void 0;var n,a,i="KaTeX parse error: "+t,o=r&&r.loc;if(o&&o.start<=o.end){var s=o.lexer.input;n=o.start,a=o.end,n===s.length?i+=" at end of input: ":i+=" at position "+(n+1)+": ";var l=s.slice(n,a).replace(/[^]/g,"$&\u0332");i+=(n>15?"\u2026"+s.slice(n-15,n):s.slice(0,n))+l+(a+15<s.length?s.slice(a,a+15)+"\u2026":s.slice(a))}var h=new Error(i);return h.name="ParseError",h.__proto__=e.prototype,h.position=n,null!=n&&null!=a&&(h.length=a-n),h.rawMessage=t,h};r.prototype.__proto__=Error.prototype;var n=r,a=/([A-Z])/g,i={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},o=/[&><"']/g;var s=function e(t){return"ordgroup"===t.type||"color"===t.type?1===t.body.length?e(t.body[0]):t:"font"===t.type?e(t.body):t},l={contains:function(e,t){return-1!==e.indexOf(t)},deflt:function(e,t){return void 0===e?t:e},escape:function(e){return String(e).replace(o,(function(e){return i[e]}))},hyphenate:function(e){return e.replace(a,"-$1").toLowerCase()},getBaseElem:s,isCharacterBox:function(e){var t=s(e);return"mathord"===t.type||"textord"===t.type||"atom"===t.type},protocolFromUrl:function(e){var t=/^\s*([^\\/#]*?)(?::|&#0*58|&#x0*3a)/i.exec(e);return null!=t?t[1]:"_relative"}},h={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:function(e){return"#"+e}},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:function(e,t){return t.push(e),t}},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:function(e){return Math.max(0,e)},cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:function(e){return Math.max(0,e)},cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:function(e){return Math.max(0,e)},cli:"-e, --max-expand <n>",cliProcessor:function(e){return"Infinity"===e?1/0:parseInt(e)}},globalGroup:{type:"boolean",cli:!1}};function c(e){if(e.default)return e.default;var t=e.type,r=Array.isArray(t)?t[0]:t;if("string"!=typeof r)return r.enum[0];switch(r){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}var m=function(){function e(e){for(var t in this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void Line truncated
@@ -0,0 +1,459 @@
/*! markmap-autoloader v0.15.4 | MIT License */
this.markmap = this.markmap || {};
(function (exports) {
'use strict';
function _extends$1() {
_extends$1 = Object.assign ? Object.assign.bind() : function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends$1.apply(this, arguments);
}
/*! markmap-common v0.15.3 | MIT License */
function _extends() {
_extends = Object.assign ? Object.assign.bind() : function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
const testPath = "npm2url/dist/index.cjs";
const defaultProviders = {
jsdelivr: path => `https://cdn.jsdelivr.net/npm/${path}`,
unpkg: path => `https://unpkg.com/${path}`
};
class UrlBuilder {
constructor() {
this.providers = _extends({}, defaultProviders);
this.provider = "jsdelivr";
}
getFastestProvider(timeout = 5e3, path = testPath) {
return new Promise((resolve, reject) => {
Promise.all(Object.entries(this.providers).map(async ([name, factory]) => {
try {
const res = await fetch(factory(path));
if (!res.ok) {
throw res;
}
await res.text();
resolve(name);
} catch (_unused) {}
})).then(() => reject(new Error("All providers failed")));
setTimeout(reject, timeout, new Error("Timed out"));
});
}
async findFastestProvider(timeout) {
this.provider = await this.getFastestProvider(timeout);
return this.provider;
}
setProvider(name, factory) {
if (factory) {
this.providers[name] = factory;
} else {
delete this.providers[name];
}
}
getFullUrl(path, provider = this.provider) {
if (path.includes("://")) {
return path;
}
const factory = this.providers[provider];
if (!factory) {
throw new Error(`Provider ${provider} not found`);
}
return factory(path);
}
}
const urlBuilder = new UrlBuilder();
Math.random().toString(36).slice(2, 8);
function memoize(fn) {
const cache = {};
return function memoized(...args) {
const key = `${args[0]}`;
let data = cache[key];
if (!data) {
data = {
value: fn(...args)
};
cache[key] = data;
}
return data.value;
};
}
/*! @gera2ld/jsx-dom v2.2.2 | ISC License */
const VTYPE_ELEMENT = 1;
const VTYPE_FUNCTION = 2;
const SVG_NS = 'http://www.w3.org/2000/svg';
const XLINK_NS = 'http://www.w3.org/1999/xlink';
const NS_ATTRS = {
show: XLINK_NS,
actuate: XLINK_NS,
href: XLINK_NS
};
const isLeaf = c => typeof c === 'string' || typeof c === 'number';
const isElement = c => (c == null ? void 0 : c.vtype) === VTYPE_ELEMENT;
const isRenderFunction = c => (c == null ? void 0 : c.vtype) === VTYPE_FUNCTION;
function h(type, props, ...children) {
props = Object.assign({}, props, {
children: children.length === 1 ? children[0] : children
});
return jsx(type, props);
}
function jsx(type, props) {
let vtype;
if (typeof type === 'string') vtype = VTYPE_ELEMENT;else if (typeof type === 'function') vtype = VTYPE_FUNCTION;else throw new Error('Invalid VNode type');
return {
vtype,
type,
props
};
}
function Fragment(props) {
return props.children;
}
const DEFAULT_ENV = {
isSvg: false
};
function insertDom(parent, nodes) {
if (!Array.isArray(nodes)) nodes = [nodes];
nodes = nodes.filter(Boolean);
if (nodes.length) parent.append(...nodes);
}
function mountAttributes(domElement, props, env) {
for (const key in props) {
if (key === 'key' || key === 'children' || key === 'ref') continue;
if (key === 'dangerouslySetInnerHTML') {
domElement.innerHTML = props[key].__html;
} else if (key === 'innerHTML' || key === 'textContent' || key === 'innerText' || key === 'value' && ['textarea', 'select'].includes(domElement.tagName)) {
const value = props[key];
if (value != null) domElement[key] = value;
} else if (key.startsWith('on')) {
domElement[key.toLowerCase()] = props[key];
} else {
setDOMAttribute(domElement, key, props[key], env.isSvg);
}
}
}
const attrMap = {
className: 'class',
labelFor: 'for'
};
function setDOMAttribute(el, attr, value, isSVG) {
attr = attrMap[attr] || attr;
if (value === true) {
el.setAttribute(attr, '');
} else if (value === false) {
el.removeAttribute(attr);
} else {
const namespace = isSVG ? NS_ATTRS[attr] : undefined;
if (namespace !== undefined) {
el.setAttributeNS(namespace, attr, value);
} else {
el.setAttribute(attr, value);
}
}
}
function flatten(arr) {
return arr.reduce((prev, item) => prev.concat(item), []);
}
function mountChildren(children, env) {
return Array.isArray(children) ? flatten(children.map(child => mountChildren(child, env))) : mount(children, env);
}
function mount(vnode, env = DEFAULT_ENV) {
if (vnode == null || typeof vnode === 'boolean') {
return null;
}
if (vnode instanceof Node) {
return vnode;
}
if (isRenderFunction(vnode)) {
const {
type,
props
} = vnode;
if (type === Fragment) {
const node = document.createDocumentFragment();
if (props.children) {
const children = mountChildren(props.children, env);
insertDom(node, children);
}
return node;
}
const childVNode = type(props);
return mount(childVNode, env);
}
if (isLeaf(vnode)) {
return document.createTextNode(`${vnode}`);
}
if (isElement(vnode)) {
let node;
const {
type,
props
} = vnode;
if (!env.isSvg && type === 'svg') {
env = Object.assign({}, env, {
isSvg: true
});
}
if (!env.isSvg) {
node = document.createElement(type);
} else {
node = document.createElementNS(SVG_NS, type);
}
mountAttributes(node, props, env);
if (props.children) {
let childEnv = env;
if (env.isSvg && type === 'foreignObject') {
childEnv = Object.assign({}, childEnv, {
isSvg: false
});
}
const children = mountChildren(props.children, childEnv);
if (children != null) insertDom(node, children);
}
const {
ref
} = props;
if (typeof ref === 'function') ref(node);
return node;
}
throw new Error('mount: Invalid Vnode!');
}
/**
* Mount vdom as real DOM nodes.
*/
function mountDom(vnode) {
return mount(vnode);
}
/**
* Render and mount without returning VirtualDOM, useful when you don't need SVG support.
*/
function hm(...args) {
return mountDom(h(...args));
}
const memoizedPreloadJS = memoize(url => {
document.head.append(hm('link', {
rel: 'preload',
as: 'script',
href: url
}));
});
const jsCache = {};
const cssCache = {};
async function loadJSItem(item, context) {
var _item$data;
const src = item.type === 'script' && ((_item$data = item.data) == null ? void 0 : _item$data.src) || '';
item.loaded || (item.loaded = jsCache[src]);
if (!item.loaded) {
if (item.type === 'script') {
item.loaded = new Promise((resolve, reject) => {
document.head.append(hm('script', _extends({}, item.data, {
onLoad: resolve,
onError: reject
})));
if (!src) {
// Run inline script synchronously
resolve(undefined);
}
}).then(() => {
item.loaded = true;
});
if (src) jsCache[src] = item.loaded;
}
if (item.type === 'iife') {
const {
fn,
getParams
} = item.data;
fn(...((getParams == null ? void 0 : getParams(context)) || []));
item.loaded = true;
}
}
await item.loaded;
}
function loadCSSItem(item) {
const url = item.type === 'stylesheet' && item.data.href || '';
item.loaded || (item.loaded = cssCache[url]);
if (item.loaded) return;
item.loaded = true;
if (url) cssCache[url] = true;
if (item.type === 'style') {
document.head.append(hm('style', {
textContent: item.data
}));
} else if (item.type === 'stylesheet') {
document.head.append(hm('link', _extends({
rel: 'stylesheet'
}, item.data)));
}
}
async function loadJS(items, context) {
items.forEach(item => {
var _item$data2;
if (item.type === 'script' && (_item$data2 = item.data) != null && _item$data2.src) {
memoizedPreloadJS(item.data.src);
}
});
context = _extends({
getMarkmap: () => window.markmap
}, context);
for (const item of items) {
await loadJSItem(item, context);
}
}
function loadCSS(items) {
for (const item of items) {
loadCSSItem(item);
}
}
function buildJSItem(path) {
return {
type: 'script',
data: {
src: path
}
};
}
function buildCSSItem(path) {
return {
type: 'stylesheet',
data: {
href: path
}
};
}
var _window$markmap;
const enabled = {};
const autoLoaderOptions = _extends$1({
baseJs: [`d3@${"7.8.5"}`, `markmap-lib@${"0.15.4"}`, `markmap-view@${"0.15.4"}`, `markmap-toolbar@${"0.15.4"}`],
baseCss: [`markmap-toolbar@${"0.15.4"}/dist/style.css`],
manual: false,
toolbar: false
}, (_window$markmap = window.markmap) == null ? void 0 : _window$markmap.autoLoader);
async function initialize() {
if (typeof autoLoaderOptions.provider === 'function') {
urlBuilder.setProvider(urlBuilder.provider = 'autoLoader', autoLoaderOptions.provider);
} else if (typeof autoLoaderOptions.provider === 'string') {
urlBuilder.provider = autoLoaderOptions.provider;
} else {
try {
await urlBuilder.findFastestProvider();
} catch (_unused) {
// ignore
}
}
await Promise.all([loadJS(autoLoaderOptions.baseJs.map(item => typeof item === 'string' ? buildJSItem(urlBuilder.getFullUrl(item)) : item)), loadCSS(autoLoaderOptions.baseCss.map(item => typeof item === 'string' ? buildCSSItem(urlBuilder.getFullUrl(item)) : item))]);
const {
markmap
} = window;
const style = document.createElement('style');
style.textContent = markmap.globalCSS;
// Insert global CSS to body so it has higher priority than prism.css, etc.
document.body.prepend(style);
autoLoaderOptions.onReady == null ? void 0 : autoLoaderOptions.onReady();
}
const ready = initialize();
function transform(transformer, content) {
const result = transformer.transform(content);
const keys = Object.keys(result.features).filter(key => !enabled[key]);
keys.forEach(key => {
enabled[key] = true;
});
const {
styles,
scripts
} = transformer.getAssets(keys);
const {
markmap
} = window;
if (styles) markmap.loadCSS(styles);
if (scripts) markmap.loadJS(scripts);
return result;
}
function render(el) {
var _el$textContent;
const {
Transformer,
Markmap,
deriveOptions,
Toolbar
} = window.markmap;
const lines = ((_el$textContent = el.textContent) == null ? void 0 : _el$textContent.split('\n')) || [];
let indent = Infinity;
lines.forEach(line => {
var _line$match;
const spaces = ((_line$match = line.match(/^\s*/)) == null ? void 0 : _line$match[0].length) || 0;
if (spaces < line.length) indent = Math.min(indent, spaces);
});
const content = lines.map(line => line.slice(indent)).join('\n').trim();
const transformer = new Transformer(autoLoaderOptions.transformPlugins);
transformer.urlBuilder = urlBuilder;
el.innerHTML = '<svg></svg>';
const svg = el.firstChild;
const mm = Markmap.create(svg, {
embedGlobalCSS: false
});
if (autoLoaderOptions.toolbar) {
const {
el: toolbar
} = Toolbar.create(mm);
Object.assign(toolbar.style, {
position: 'absolute',
right: '20px',
bottom: '20px'
});
el.append(toolbar);
}
const doRender = () => {
const {
root,
frontmatter
} = transform(transformer, content);
const markmapOptions = frontmatter == null ? void 0 : frontmatter.markmap;
const frontmatterOptions = deriveOptions(markmapOptions);
mm.setData(root, frontmatterOptions);
mm.fit();
};
transformer.hooks.retransform.tap(doRender);
doRender();
}
async function renderAllUnder(container) {
await ready;
container.querySelectorAll('.markmap').forEach(render);
}
function renderAll() {
return renderAllUnder(document);
}
if (!autoLoaderOptions.manual) {
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', () => {
renderAll();
});else renderAll();
}
exports.ready = ready;
exports.render = render;
exports.renderAll = renderAll;
exports.renderAllUnder = renderAllUnder;
})(this.markmap.autoLoader = this.markmap.autoLoader || {});
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,8 @@
/**
* plotly.js v2.27.0
* Copyright 2012-2023, Plotly, Inc.
* All rights reserved.
* Licensed under the MIT license
*/
/*! For license information please see plotly.min.js.LICENSE.txt */
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Plotly=e():t.Plotly=e()}(self,(function(){return function(){var t={98847:function(t,e,r){"use strict";var n=r(71828),i={"X,X div":'direction:ltr;font-family:"Open Sans",verdana,arial,sans-serif;margin:0;padding:0;',"X input,X button":'font-family:"Open Sans",verdana,arial,sans-serif;',"X input:focus,X button:focus":"outline:none;","X a":"text-decoration:none;","X a:hover":"text-decoration:none;","X .crisp":"shape-rendering:crispEdges;","X .user-select-none":"-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;","X svg":"overflow:hidden;","X svg a":"fill:#447adb;","X svg a:hover":"fill:#3c6dc5;","X .main-svg":"position:absolute;top:0;left:0;pointer-events:none;","X .main-svg .draglayer":"pointer-events:all;","X .cursor-default":"cursor:default;","X .cursor-pointer":"cursor:pointer;","X .cursor-crosshair":"cursor:crosshair;","X .cursor-move":"cursor:move;","X .cursor-col-resize":"cursor:col-resize;","X .cursor-row-resize":"cursor:row-resize;","X .cursor-ns-resize":"cursor:ns-resize;","X .cursor-ew-resize":"cursor:ew-resize;","X .cursor-sw-resize":"cursor:sw-resize;","X .cursor-s-resize":"cursor:s-resize;","X .cursor-se-resize":"cursor:se-resize;","X .cursor-w-resize":"cursor:w-resize;","X .cursor-e-resize":"cursor:e-resize;","X .cursor-nw-resize":"cursor:nw-resize;","X .cursor-n-resize":"cursor:n-resize;","X .cursor-ne-resize":"cursor:ne-resize;","X .cursor-grab":"cursor:-webkit-grab;cursor:grab;","X .modebar":"position:absolute;top:2px;right:2px;","X .ease-bg":"-webkit-transition:background-color .3s ease 0s;-moz-transition:background-color .3s ease 0s;-ms-transition:background-color .3s ease 0s;-o-transition:background-color .3s ease 0s;transition:background-color .3s ease 0s;","X .modebar--hover>:not(.watermark)":"opacity:0;-webkit-transition:opacity .3s ease 0s;-moz-transition:opacity .3s ease 0s;-ms-transition:opacity .3s ease 0s;-o-transition:opacity .3s ease 0s;transition:opacity .3s ease 0s;","X:hover .modebar--hover .modebar-group":"opacity:1;","X .modebar-group":"float:left;display:inline-block;box-sizing:border-box;padding-left:8px;position:relative;vertical-align:middle;white-space:nowrap;","X .modebar-btn":"position:relative;font-size:16px;padding:3px 4px;height:22px;cursor:pointer;line-height:normal;box-sizing:border-box;","X .modebar-btn svg":"position:relative;top:2px;","X .modebar.vertical":"display:flex;flex-direction:column;flex-wrap:wrap;align-content:flex-end;max-height:100%;","X .modebar.vertical svg":"top:-1px;","X .modebar.vertical .modebar-group":"display:block;float:none;padding-left:0px;padding-bottom:8px;","X .modebar.vertical .modebar-group .modebar-btn":"display:block;text-align:center;","X [data-title]:before,X [data-title]:after":"position:absolute;-webkit-transform:translate3d(0, 0, 0);-moz-transform:translate3d(0, 0, 0);-ms-transform:translate3d(0, 0, 0);-o-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0);display:none;opacity:0;z-index:1001;pointer-events:none;top:110%;right:50%;","X [data-title]:hover:before,X [data-title]:hover:after":"display:block;opacity:1;","X [data-title]:before":'content:"";position:absolute;background:rgba(0,0,0,0);border:6px solid rgba(0,0,0,0);z-index:1002;margin-top:-12px;border-bottom-color:#69738a;margin-right:-6px;',"X [data-title]:after":"content:attr(data-title);background:#69738a;color:#fff;padding:8px 10px;font-size:12px;line-height:12px;white-space:nowrap;margin-right:-18px;border-radius:2px;","X .vertical [data-title]:before,X .vertical [data-title]:after":"top:0%;right:200%;","X .vertical [data-title]:before":"border:6px solid rgba(0,0,0,0);border-left-color:#69738a;margin-top:8px;margin-right:-30px;",Y:'font-family:"Open Sans",verdana,arial,sans-serif;position:fixed;top:50px;right:20px;z-index:10000;font-size:10pt;max-width:180px;',"Y p":"margin:0;","Y .notifier-note":"min-width:180px;max-width:250px;border:1px solid #fff;z-index:3000;margin:0;background-color:#8c97af;background-color:rgba(140,151,175,.9);color:#fff;padding:10px;overflow-wrap:break-word;word-wrap:break-word;-ms-hyphens:auto;-webkit-hyphens:auto;hyphens:auto;","Y .notifier-close":"color:#fff;opacity:.8;float:right;padding:0 5px;background:none;border:none;font-size:20px;font-weight:bold;line-height:20px;","Y .notifier-close:hover":"color:#444;text-decoration:none;cursor:pointer;"};for(var a in i){var o=a.replace(/^,/," ,").replace(/X/g,".js-plotly-plot .plotly").replace(/Y/g,".plotly-notifier");n.addStyleRule(o,i[a])}},98222:function(t,e,r){"use strict";t.exports=r(82887)},27206:function(t,e,r){"use strict";t.exports=r(60822)},59893:function(t,e,r){"use strict";t.exports=r(23381)},5224:function(t,e,r){"use strict";t.exports=r(83832)},59509:function(t,e,r){"use strict";t.exports=r(72201)},75557:function(t,e,r){"use strict";t.exports=r(91815)Line truncated
@@ -0,0 +1,56 @@
import {hugoEnvironment, i18n} from '@params';
console.debug(`Environment: ${hugoEnvironment}`);
async function copyCodeToClipboard(button, codeWrapper) {
const codeToCopy = codeWrapper.textContent;
try {
if ('clipboard' in navigator) {
// Note: Clipboard API requires HTTPS or localhost
await navigator.clipboard.writeText(codeToCopy);
} else {
console.error('Failed to copy. Dead browser.')
}
} catch (_) {
console.error('Failed to copy. Check permissions...')
} finally {
copiedNotification(button);
}
}
function copiedNotification(copyBtn) {
copyBtn.innerHTML = i18n['copied'];
setTimeout(() => {
copyBtn.innerHTML = i18n['copy'];
}, 2000);
}
// Code block copy button
window.addEventListener("DOMContentLoaded", () => {
document.querySelectorAll('pre > code').forEach((codeblock) => {
const container = codeblock.parentNode.parentNode;
// Create copy button
const copyBtn = document.createElement('button');
let classesToAdd = ['copy-button'];
copyBtn.classList.add(...classesToAdd);
copyBtn.innerHTML = i18n['copy'];
// There are 3 kinds of code block wrappers in Hugo, handle them all.
let wrapper;
if (container.classList.contains('highlight')) {
// Parent when Hugo line numbers disabled
wrapper = container;
} else if (codeblock.parentNode.parentNode.parentNode.parentNode.parentNode.nodeName === 'TABLE') {
// Parent when Hugo line numbers enabled
wrapper = codeblock.parentNode.parentNode.parentNode.parentNode.parentNode;
} else {
// Parent when Hugo `highlight` class not applied to code block
// Hugo only applies `highlight` class when a language is specified on the Markdown block
// But we need the `highlight` style to be applied so that absolute button has relative block parent
codeblock.parentElement.classList.add('highlight');
wrapper = codeblock.parentNode;
}
copyBtn.addEventListener("click", () => copyCodeToClipboard(copyBtn, wrapper));
wrapper.appendChild(copyBtn);
});
});
@@ -0,0 +1,19 @@
function getCssVar(name) {
return "rgb(" + getComputedStyle(document.documentElement).getPropertyValue(name) + ")";
}
window.mermaid.initialize({
theme: "base",
themeVariables: {
background: getCssVar("--color-neutral"),
primaryColor: getCssVar("--color-primary-200"),
secondaryColor: getCssVar("--color-secondary-200"),
tertiaryColor: getCssVar("--color-neutral-100"),
primaryBorderColor: getCssVar("--color-primary-400"),
secondaryBorderColor: getCssVar("--color-secondary-400"),
tertiaryBorderColor: getCssVar("--color-neutral-400"),
lineColor: getCssVar("--color-neutral-600"),
fontFamily: getComputedStyle(document.documentElement).getPropertyValue('font-family'),
fontSize: "16px",
},
});
+3 -7
View File
@@ -28,13 +28,9 @@ rss: <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" str
</svg>
# Callouts
information-circle: <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
<path stroke-linecap="round" stroke-linejoin="round" d="M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z" />
</svg>
exclamation-triangle: <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
<path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z" />
</svg>
information-circle: <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6"><path stroke-linecap="round" stroke-linejoin="round" d="M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z" /></svg>
exclamation-triangle: <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6"><path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z" /></svg>
# Skills
python: <svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 448 512"><path d="M439.8 200.5c-7.7-30.9-22.3-54.2-53.4-54.2h-40.1v47.4c0 36.8-31.2 67.8-66.8 67.8H172.7c-29.2 0-53.4 25-53.4 54.3v101.8c0 29 25.2 46 53.4 54.3 33.8 9.9 66.3 11.7 106.8 0 26.9-7.8 53.4-23.5 53.4-54.3v-40.7H226.2v-13.6h160.2c31.1 0 42.6-21.7 53.4-54.2 11.2-33.5 10.7-65.7 0-108.6zM286.2 404c11.1 0 20.1 9.1 20.1 20.3 0 11.3-9 20.4-20.1 20.4-11 0-20.1-9.2-20.1-20.4.1-11.3 9.1-20.3 20.1-20.3zM167.8 248.1h106.8c29.7 0 53.4-24.5 53.4-54.3V91.9c0-29-24.4-50.7-53.4-55.6-35.8-5.9-74.7-5.6-106.8.1-45.2 8-53.4 24.7-53.4 55.6v40.7h106.9v13.6h-147c-31.1 0-58.3 18.7-66.8 54.2-9.8 40.7-10.2 66.1 0 108.6 7.6 31.6 25.7 54.2 56.8 54.2H101v-48.8c0-35.3 30.5-66.4 66.8-66.4zm-6.7-142.6c-11.1 0-20.1-9.1-20.1-20.3.1-11.3 9-20.4 20.1-20.4 11 0 20.1 9.2 20.1 20.4s-9 20.3-20.1 20.3z"/></svg>
python: <svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 448 512" fill="currentColor"><path d="M439.8 200.5c-7.7-30.9-22.3-54.2-53.4-54.2h-40.1v47.4c0 36.8-31.2 67.8-66.8 67.8H172.7c-29.2 0-53.4 25-53.4 54.3v101.8c0 29 25.2 46 53.4 54.3 33.8 9.9 66.3 11.7 106.8 0 26.9-7.8 53.4-23.5 53.4-54.3v-40.7H226.2v-13.6h160.2c31.1 0 42.6-21.7 53.4-54.2 11.2-33.5 10.7-65.7 0-108.6zM286.2 404c11.1 0 20.1 9.1 20.1 20.3 0 11.3-9 20.4-20.1 20.4-11 0-20.1-9.2-20.1-20.4.1-11.3 9.1-20.3 20.1-20.3zM167.8 248.1h106.8c29.7 0 53.4-24.5 53.4-54.3V91.9c0-29-24.4-50.7-53.4-55.6-35.8-5.9-74.7-5.6-106.8.1-45.2 8-53.4 24.7-53.4 55.6v40.7h106.9v13.6h-147c-31.1 0-58.3 18.7-66.8 54.2-9.8 40.7-10.2 66.1 0 108.6 7.6 31.6 25.7 54.2 56.8 54.2H101v-48.8c0-35.3 30.5-66.4 66.8-66.4zm-6.7-142.6c-11.1 0-20.1-9.1-20.1-20.3.1-11.3 9-20.4 20.1-20.4 11 0 20.1 9.2 20.1 20.4s-9 20.3-20.1 20.3z"/></svg>
@@ -0,0 +1,3 @@
# Wowchemy metadata
version = "0.1.0"
@@ -0,0 +1,5 @@
<div class="markmap" style="height: {{.Attributes.height | default "500px"}};">
{{/* No indentation before PRE and .Inner otherwise mindmap first item will be indented */}}
<pre>{{- .Inner | safeHTML -}}</pre>
</div>
{{ .Page.Store.Set "has_markmap" true }}
@@ -0,0 +1,4 @@
<div class="mermaid">
{{- .Inner | safeHTML }}
</div>
{{ .Page.Store.Set "has_mermaid" true }}
@@ -0,0 +1,72 @@
{{/* Markdown Image Renderer for Wowchemy. */}}
{{/* Load image from page dir falling back to media library at `assets/media/` and then to remote URI. */}}
{{ $destination := .Destination }}
{{ $is_remote := strings.HasPrefix $destination "http" }}
{{ $caption := .Title | default "" }}
{{ $zoom := "true" }}
{{ $id := anchorize ($caption | plainify) }}
{{ $alt := .Text | default ($caption | plainify) }}
{{ $img_class := "" }}
{{ $fig_class := "" }}
{{ $max_width := "" }}
{{ $width := "" }}
{{ $height := "" }}
{{ $numbered := false }}
{{/* Workaround Hugo v0.81 error on Windows when `resources.Get (path.Join "media" <URL>)` */}}
{{- $img := "" -}}
{{- if not $is_remote -}}
{{- $img = (.Page.Resources.ByType "image").GetMatch $destination -}}
{{- if not $img -}}
{{- $img = resources.Get (path.Join "media" $destination) -}}
{{- end -}}
{{- end -}}
<figure {{ with $fig_class }}class="{{.}}"{{end}} {{ with $id }}id="figure-{{ . }}"{{ end }}>
<div class="flex justify-center ">
<div class="w-100" {{ with $max_width }}style="max-width: {{.}}"{{end}}>
{{- if $img -}}
{{- $isSVG := eq $img.MediaType.SubType "svg" -}}
{{- $isGIF := eq $img.MediaType.SubType "gif" -}}
{{- if $isSVG | or $isGIF -}}
<img alt="{{ $alt }}"
src="{{ $img.RelPermalink }}"
loading="lazy"
{{- if $zoom }} data-zoomable{{end}}
{{- with $width }} width="{{.}}"{{end}}
{{- with $height }} height="{{.}}"{{end}}
{{- with $img_class }} class="{{.}}"{{end}} />
{{- else }}
{{- $img_lg := $img.Fit "1200x1200 webp" -}}
{{- $img_md := $img_lg.Fit "760x760 webp" -}}{{/* Match `.docs-article-container` max-width */}}
{{- $img_sm := $img_md.Fit "400x400 webp" -}}
{{- $width := $width | default $img_md.Width -}}
{{- $height := $height | default $img_md.Height -}}
<img alt="{{ $alt }}" srcset="
{{ $img_sm.RelPermalink }} 400w,
{{ $img_md.RelPermalink }} 760w,
{{ $img_lg.RelPermalink }} 1200w"
src="{{ $img_sm.RelPermalink }}"
width="{{ $width }}"
height="{{ $height }}"
loading="lazy"
{{- if $zoom }} data-zoomable{{end}}
{{- with $img_class }} class="{{.}}"{{end}} />
{{- end }}
{{- else -}}
<img src="{{ $destination | safeURL }}" alt="{{ $alt }}" loading="lazy" {{ if $zoom }}data-zoomable{{end}}
{{- with $width }} width="{{.}}"{{end}} {{- with $height }} height="{{.}}"{{end}}
{{- with $img_class }} class="{{.}}"{{end}} />
{{- end -}}
</div>
</div>
{{- if $caption -}}
{{/* Localize the figure numbering (if enabled). */}}
{{- $figure := split (i18n "figure" | default "Figure %d:") "%d" -}}
<figcaption{{ if eq $numbered "true" }} data-pre="{{- trim (index $figure 0) " " -}}&nbsp;" data-post="{{ index $figure 1 }}&nbsp;" class="numbered"{{ end }}>
{{ $caption | markdownify | emojify }}
</figcaption>
{{- end -}}
</figure>
@@ -0,0 +1,2 @@
{{- /* A Hugo Markdown render hook to parse links, opening external links in new tabs. */ -}}
<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank" rel="noopener"{{ end }}>{{ .Text | safeHTML }}</a>
@@ -0,0 +1,54 @@
{{ if .Params.pager | default true }}
{{ if or .NextInSection .PrevInSection }}
{{ $next := .NextInSection }}
{{ $prev := .PrevInSection }}
{{ if .Params.invert_pager | default false }}
{{ $next = .PrevInSection }}
{{ $prev = .NextInSection }}
{{ end }}
<div class="pt-1">
<hr class="border-dotted border-neutral-300 dark:border-neutral-600" />
<div class="flex justify-between pt-2">
<span>
{{ if $prev }}
<a class="group flex no-underline" href="{{ $prev.RelPermalink }}">
<span
class="me-2 text-neutral-700 transition-transform group-hover:-translate-x-[2px] group-hover:text-primary-600 dark:text-neutral dark:group-hover:text-primary-400"
><span class="ltr:inline rtl:hidden">&larr;</span></span>
<span class="flex flex-col">
<span
class="mt-[0.1rem] leading-6 group-hover:underline group-hover:decoration-primary-500"
>{{ $prev.Title }}</span>
<span class="mt-[0.1rem] text-xs text-neutral-500 dark:text-neutral-400">
{{ if .Params.show_date | default true }}
{{ time.Format (site.Params.locale.date_format | default ":date_long") $prev.Date }}
{{ end }}
</span>
</span>
</a>
{{ end }}
</span>
<span>
{{ if $next }}
<a class="group flex text-right no-underline" href="{{ $next.RelPermalink }}">
<span class="flex flex-col">
<span
class="mt-[0.1rem] leading-6 group-hover:underline group-hover:decoration-primary-500"
>{{ $next.Title }}</span
>
<span class="mt-[0.1rem] text-xs text-neutral-500 dark:text-neutral-400">
{{ if .Params.show_date | default true }}
{{ time.Format (site.Params.locale.date_format | default ":date_long") $next.Date }}
{{ end }}
</span>
</span>
<span
class="ms-2 text-neutral-700 transition-transform group-hover:-translate-x-[2px] group-hover:text-primary-600 dark:text-neutral dark:group-hover:text-primary-400"
><span class="ltr:inline">&rarr;</span></span>
</a>
{{ end }}
</span>
</div>
</div>
{{ end }}
{{ end }}
@@ -1,18 +0,0 @@
{{ $str := "" }}
<div class="post-nav">
{{if .NextInSection}}
{{/* For the Book layout, prev/next labels are reversed. */}}
{{ if in (slice "docs" "book") .Type }}{{ $str = "previous" }}{{else}}{{ $str = "next" }}{{end}}
<div class="post-nav-item">
<div class="meta-nav">{{ i18n $str }}</div>
<a href="{{.NextInSection.RelPermalink}}" rel="next">{{.NextInSection.Title}}</a>
</div>
{{end}}
{{if .PrevInSection}}
{{ if in (slice "docs" "book") .Type }}{{ $str = "next" }}{{else}}{{ $str = "previous" }}{{end}}
<div class="post-nav-item">
<div class="meta-nav">{{ i18n $str }}</div>
<a href="{{.PrevInSection.RelPermalink}}" rel="prev">{{.PrevInSection.Title}}</a>
</div>
{{end}}
</div>
@@ -0,0 +1,57 @@
{{/* Mermaid */}}
{{ if (.Page.Store.Get "has_mermaid") }}
{{ $mermaid_js := resources.Get "dist/lib/mermaid/mermaid.min.js" }}
{{ $mermaid_config_js := resources.Get "js/wowchemy-mermaid-config.js" }}
{{ $mermaid_config_js = $mermaid_config_js | resources.Minify }}
{{ $mermaid_bundle := slice $mermaid_js $mermaid_config_js | resources.Concat "js/mermaid.bundle.js" | resources.Fingerprint }}
<script defer src="{{ $mermaid_bundle.RelPermalink }}" integrity="{{ $mermaid_bundle.Data.Integrity }}"></script>
{{ end }}
{{/* Markmap */}}
{{ if (.Page.Store.Get "has_markmap") }}
<style>
.markmap > svg {
width: 100%;
height: 100%;
}
</style>
<script>
window.markmap = {
autoLoader: {
manual: false,
onReady() {
const { autoLoader, builtInPlugins } = window.markmap;
// Disable Prism highlighting plugin as it conflicts and attempts to re-render code blocks outside of Markmap.
autoLoader.transformPlugins = builtInPlugins.filter(plugin => plugin.name !== 'prism');
},
},
};
</script>
{{ $markmap_js := resources.Get "dist/lib/markmap/index.js" }}
{{ $markmap_js = $markmap_js | resources.Minify | resources.Fingerprint }}
<script defer src="{{ $markmap_js.RelPermalink }}" integrity="{{ $markmap_js.Data.Integrity }}"></script>
{{ end }}
{{/* Katex */}}
{{ if (.Page.HasShortcode "math") | or .Params.math | or site.Params.features.math.enable }}
{{ $katex_css := resources.Get "dist/lib/katex/katex.min.css" }}
{{ $katex_css = $katex_css | resources.Fingerprint }}
<link type="text/css" rel="stylesheet" href="{{ $katex_css.RelPermalink }}" integrity="{{ $katex_css.Data.Integrity }}" />
{{ $katex_js := resources.Get "dist/lib/katex/katex.min.js" }}
{{ $katex_js = $katex_js | resources.Fingerprint }}
<script defer src="{{ $katex_js.RelPermalink }}" integrity="{{ $katex_js.Data.Integrity }}"></script>
{{ $katex_render_js := resources.Get "dist/lib/katex/auto-render.min.js" }}
{{ $katex_render_js = $katex_render_js | resources.Fingerprint }}
<script defer src="{{ $katex_render_js.RelPermalink }}" integrity="{{ $katex_render_js.Data.Integrity }}" onload="renderMathInElement(document.body);"></script>
{{ $katex_fonts := resources.Match "dist/lib/katex/fonts/*" }}
{{ range $katex_fonts }}
{{ .Publish }}
{{ end }}
{{ end }}
{{/* Plotly */}}
{{ if .Page.HasShortcode "chart" }}
{{ $plotly_js := resources.Get "dist/lib/plotly/plotly.min.js" }}
{{ $plotly_js = $plotly_js | resources.Fingerprint }}
<script defer src="{{ $plotly_js.RelPermalink }}" integrity="{{ $plotly_js.Data.Integrity }}"></script>
{{ end }}
@@ -1,13 +1,9 @@
{{ partial "page_edit" . }}
{{ partial "tags" . }}
{{/* partial "components/page_sharer" . */}}
{{ partial "page_author" . }}
{{ partial "comments" . }}
{{ if .Params.pager }}
<div class="article-widget">
{{/* partial "components/pager" . */}}
<div class="max-w-prose print:hidden">
{{ partial "page_edit" . }}
{{ partial "tags" . }}
{{/* partial "components/page_sharer" . */}}
{{ partial "page_author" . }}
{{ partial "components/next-in-series" . }}
{{/* partial "page_related" . */}}
{{ partial "comments" . }}
</div>
{{ end }}
{{/* partial "page_related" . */}}
@@ -156,27 +156,6 @@
});
</script>
{{/* Config LaTeX math rendering. */}}
{{ if or .Params.math site.Params.features.math.enable }}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/katex.min.css" integrity="sha384-Xi8rHCmBmhbuyyhbI88391ZKP2dmfnOl4rT9ZfRI7mLTdk1wblIUnrIq35nqwEvC" crossorigin="anonymous" media="print" onload="this.media='all'">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/katex.min.js" integrity="sha384-X/XCfMm41VSsqRNQgDerQczD69XqmjOOOwYQvr/uuC+j4OPoNhVgjdGFwhvN02Ja" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/contrib/auto-render.min.js" integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" crossorigin="anonymous"></script>
<script>
document.addEventListener("DOMContentLoaded", function() {
renderMathInElement(document.body, {
// Add support for inline math with `$...$`
delimiters: [
{left: '$$', right: '$$', display: true},
{left: '$', right: '$', display: false},
{left: '\\(', right: '\\)', display: false},
{left: '\\[', right: '\\]', display: true}
],
throwOnError: false
});
});
</script>
{{ end }}
{{/* Hugo Chroma Syntax Highlighter Initialization */}}
{{/* TODO: optimize to only include the Chroma CSS themes when the page has code blocks. */}}
{{ $hl_theme_light := site.Params.features.syntax_highlighter.theme_light | default "github-light" }}
@@ -297,6 +276,27 @@
}
</style>
{{/* Load Third-Party Libraries */}}
{{ partial "libraries.html" . }}
{{ $js_license := printf "/*! Wowchemy Tailwind UI v%s | https://wowchemy.com/ */\n" site.Data.wowchemy.version }}
{{ $js_license := $js_license | printf "%s/*! Copyright 2016-present George Cushen (https://georgecushen.com/) */\n" }}
{{ $js_license := $js_license | printf "%s/*! License: https://github.com/wowchemy/wowchemy-hugo-themes/blob/main/LICENSE.md */\n" }}
{{ $js_bundle_head := $js_license | resources.FromString "js/bundle-head.js" }}
{{ $i18n := dict "copy" (i18n "btn_copy") "copied" (i18n "btn_copied" | default "Copied") }}
{{ $js_params := dict "hugoEnvironment" hugo.Environment "i18n" $i18n }}
{{ $js_academic := resources.Get "js/wowchemy-code-copy.js" | js.Build (dict "targetPath" (printf "js/wow-core-%s.js" .Lang ) "params" $js_params) }}
{{ $js_academic := $js_academic | resources.Minify }}
{{ $js_bundle := slice $js_bundle_head $js_academic | resources.Concat (printf "js/wowchemy-%s.min.js" .Lang) }}
{{- if hugo.IsProduction -}}
{{ $js_bundle = $js_bundle | fingerprint "md5" }}
{{- end -}}
<script
defer
src="{{ $js_bundle.RelPermalink }}"
integrity="{{ $js_bundle.Data.Integrity }}"
></script>
{{/* EXTENSIBILITY HOOK: HEAD-END */}}
{{/* Deprecated custom_head hook */}}
{{ if templates.Exists "partials/custom_head" }}
@@ -2,7 +2,7 @@
{{ if .Param $taxonomy }}
<div class="flex justify-center">
{{ range $index, $value := (.GetTerms $taxonomy) }}
<a class="no-underline bg-blue-100 text-blue-800 text-xs font-medium mr-2 px-2.5 py-0.5 rounded dark:bg-blue-900 dark:text-blue-300" href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
<a class="no-underline bg-blue-100 text-blue-800 text-xs font-medium mr-2 px-2.5 py-0.5 lg:px-5 lg:py-2 rounded dark:bg-blue-900 dark:text-blue-300" href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
{{ end }}
</div>
{{ end }}
@@ -9,17 +9,21 @@
Otherwise, you can add your own icon to assets/media/icons/ and reference its name when calling the shortcode.
*/}}
{{ $icon := "information-circle" }}
{{ $class := "bg-primary-100 dark:bg-primary-900" }}
{{ $class_text := "text-primary-400" }}
{{ with (.Get 0) }}
{{ if eq . "note" }}
{{ $icon = "information-circle" }}
{{ else if eq . "warning" }}
{{ $icon = "triangle-exclamation" }}
{{ $icon = "exclamation-triangle" }}
{{ $class = "bg-yellow-100 dark:bg-yellow-900" }}
{{ $class_text = "text-red-400" }}
{{ else }}
{{ $icon = . }}
{{end}}
{{end}}
<div class="flex px-4 py-3 rounded-md bg-primary-100 dark:bg-primary-900">
<span class="pr-3 pt-1 text-primary-400">
<div class="flex px-4 py-3 rounded-md {{$class}}">
<span class="pr-3 pt-1 {{$class_text}}">
{{ partial "functions/get_icon" (dict "name" $icon "attributes" "height=\"24\"") }}
</span>
<span class="dark:text-neutral-300">
@@ -0,0 +1,35 @@
{{/*
Docs: https://wowchemy.com/docs/content/writing-markdown-latex/#charts
Parameters
----------
data :
Plotly JSON file name (without ".json" extension, since it is appended automatically to the name).
Expects the JSON file to be placed in the page folder.(.Get "data")
*/}}
{{ $json := printf "./%s.json" (.Get "data") }}
{{ $id := delimit (shuffle (seq 1 9)) "" }}
<div id="chart-{{$id}}" class="chart"></div>
<script>
async function fetchChartJSON() {
console.debug('Wowchemy fetching chart JSON...')
const response = await fetch('{{$json}}');
return await response.json();
}
(function() {
let a = setInterval( function() {
if ( typeof window.Plotly === 'undefined' ) {
console.debug('Plotly not loaded yet...')
return;
}
clearInterval( a );
fetchChartJSON().then(chart => {
console.debug('Plotting chart...')
window.Plotly.newPlot('chart-{{$id}}', chart.data, chart.layout, {responsive: true});
});
}, 500 );
})();
</script>
+13 -14
View File
@@ -1,32 +1,31 @@
{
"comments": {
"dependencies": {},
"devDependencies": {
"@tailwindcss/typography": "project",
"autoprefixer": "project",
"postcss": "project",
"postcss-cli": "project",
"postcss-purgecss": "project",
"tailwindcss": "project"
}
"dependencies": {
"katex": "^0.16.9",
"markmap-autoloader": "^0.15.4",
"mermaid": "^10.6.0",
"plotly.js": "^2.27.0",
"vite": "^4.5.0",
"vite-plugin-static-copy": "^0.17.0"
},
"devDependencies": {
"@tailwindcss/typography": "^0.5.4",
"@tailwindcss/typography": "^0.5.10",
"autoprefixer": "^10.4.8",
"postcss": "^8.4.16",
"postcss-cli": "^10.0.0",
"postcss-import": "^14.1.0",
"postcss-purgecss": "^2.0.3",
"tailwindcss": "^3.1.8"
"tailwindcss": "^3.3.5"
},
"license": "MIT",
"name": "wowchemy-tailwind",
"description": "Tailwind UI for Hugo",
"homepage": "https://wowchemy.com",
"repository": {
"type": "git",
"url": "https://github.com/wowchemy/wowchemy-hugo-themes.git"
},
"scripts": {
"build:blog": "npx tailwindcss -i ./assets/css/styles.css -o ../../starters/blog/assets/dist/wc.css --minify"
"build:blog": "npx tailwindcss -i ./assets/css/styles.css -o ../../starters/blog/assets/dist/wc.css --minify",
"assets:dist": "vite build"
},
"browserslist": "last 2 versions",
"version": "0.1.0"
File diff suppressed because it is too large. Load diff
@@ -37,6 +37,18 @@ module.exports = {
800: "rgba(var(--color-primary-800), <alpha-value>)",
900: "rgba(var(--color-primary-900), <alpha-value>)",
},
secondary: {
50: "rgba(var(--color-secondary-50), <alpha-value>)",
100: "rgba(var(--color-secondary-100), <alpha-value>)",
200: "rgba(var(--color-secondary-200), <alpha-value>)",
300: "rgba(var(--color-secondary-300), <alpha-value>)",
400: "rgba(var(--color-secondary-400), <alpha-value>)",
500: "rgba(var(--color-secondary-500), <alpha-value>)",
600: "rgba(var(--color-secondary-600), <alpha-value>)",
700: "rgba(var(--color-secondary-700), <alpha-value>)",
800: "rgba(var(--color-secondary-800), <alpha-value>)",
900: "rgba(var(--color-secondary-900), <alpha-value>)",
},
},
fontFamily: {
'sans': ['"Inter var"', ...defaultTheme.fontFamily.sans],
+41
View File
@@ -0,0 +1,41 @@
import {defineConfig} from 'vite'
import {viteStaticCopy} from 'vite-plugin-static-copy'
import {rm} from 'node:fs/promises'
const distDir = './assets/dist/lib';
export default defineConfig({
build: {
// Wipe `assets/dist/lib/` first to remove old artifacts prior to copying latest assets across.
emptyOutDir: true,
outDir: distDir,
rollupOptions: {
// Vite requires us to provide an input even though we want to build site with Hugo instead.
input: 'layouts/index.html',
},
},
plugins: [viteStaticCopy({
targets: [{
"src": "node_modules/mermaid/dist/mermaid.min.js", "dest": "mermaid/"
}, {
"src": "node_modules/plotly.js/dist/plotly.min.js", "dest": "plotly/"
}, {
"src": "node_modules/katex/dist/katex.min.js", "dest": "katex/"
}, {
"src": "node_modules/katex/dist/katex.min.css", "dest": "katex/"
}, {
"src": "node_modules/katex/dist/contrib/auto-render.min.js", "dest": "katex/"
}, {
"src": "node_modules/katex/dist/fonts/", "dest": "katex/"
}, {
"src": "node_modules/markmap-autoloader/dist/index.js", "dest": "markmap/"
},
],
hook: "buildStart", enforce: 'pre'
}), {
name: "Cleaning assets folder", async closeBundle() {
await rm(distDir + '/layouts', {recursive: true, force: true});
},
},]
})