add markdown rendering for program

This commit is contained in:
Lyn Fugmann 2024-09-27 16:32:04 +02:00
parent e376bc1389
commit 49f39f1ecb
6 changed files with 126 additions and 25 deletions

View file

@ -69,6 +69,16 @@ p {
line-height: 1.8; line-height: 1.8;
} }
a.link {
color: var(--color-primary);
text-decoration: underline dotted var(--color-primary);
font-weight: 500;
transition: filter .1s ease-out;
}
a.link:hover {
filter: brightness(.8);
}
a.btn { a.btn {
display: block; display: block;
width: fit-content; width: fit-content;

View file

@ -34,19 +34,19 @@
<span class="full">{{ event.start }}{{ " " + event.end if event.end }}</span> <span class="full">{{ event.start }}{{ " " + event.end if event.end }}</span>
</div> </div>
<p>{{ getLocalized(event.description) }}</p> <p>{{ getLocalized(event.description) | mdInline | safe }}</p>
{% if event.annotation %} {% if event.annotation %}
<p class="annotation"> <p class="annotation">
{% icon "solid:exclamation", title=("Notice" if lang == "en" else "Hinweis") %} {% icon "solid:exclamation", title=("Notice" if lang == "en" else "Hinweis") %}
{{ getLocalized(event.annotation) }} {{ getLocalized(event.annotation) | mdInline | safe }}
</p> </p>
{% endif %} {% endif %}
{% if event.location %} {% if event.location %}
<p class="location"> <p class="location">
{% icon "solid:location-dot", title=("Location" if lang == "en" else "Veranstaltungsort") %} {% icon "solid:location-dot", title=("Location" if lang == "en" else "Veranstaltungsort") %}
{{ getLocalized(event.location) }} {{ getLocalized(event.location) | mdInline | safe }}
</p> </p>
{% endif %} {% endif %}

View file

@ -84,7 +84,7 @@
description: description:
de: Wir laden euch ein, den Abend mit uns zu verbringen und euch ins studentische Nachtleben zu stürzen. Nach und nach werden wir uns von einem Studentenclub zum Nächsten vorarbeiten. Hier sind übrigens auch die Studierenden aller anderen Fachschaften dabei. Vernetzung heißt das Stichwort. de: Wir laden euch ein, den Abend mit uns zu verbringen und euch ins studentische Nachtleben zu stürzen. Nach und nach werden wir uns von einem Studentenclub zum Nächsten vorarbeiten. Hier sind übrigens auch die Studierenden aller anderen Fachschaften dabei. Vernetzung heißt das Stichwort.
en: Tour through all the Student Clubs in Dresden. en: Tour through all the Student Clubs in Dresden.
location: "Start: APB" location: "Start: APB [test](/campus/)"
annotation: annotation:
de: Bitte Bargeld mitbringen. de: Bitte Bargeld mitbringen.
en: Please carry some cash. en: Please carry some cash.
@ -141,7 +141,7 @@
en: Lab tour en: Lab tour
description: description:
de: Was macht man eigentlich so nach dem Studium? Komm mit uns auf eine Labortour und schau in der Forschung vorbei! de: Was macht man eigentlich so nach dem Studium? Komm mit uns auf eine Labortour und schau in der Forschung vorbei!
en: null en: TBA
location: APB location: APB
- start: 14:50 - start: 14:50
@ -187,7 +187,7 @@
description: description:
de: Im Namen des Rektorats und des Senats der Technischen Universität Dresden lädt Frau Professorin Ursula M. Staudinger, Rektorin der TU Dresden, zur Feierlichen Immatrikulation der Studierenden des neuen Studienjahrgangs 2023/2024 sehr herzlich ein. de: Im Namen des Rektorats und des Senats der Technischen Universität Dresden lädt Frau Professorin Ursula M. Staudinger, Rektorin der TU Dresden, zur Feierlichen Immatrikulation der Studierenden des neuen Studienjahrgangs 2023/2024 sehr herzlich ein.
en: TBA en: TBA
location: Hörsaalzentrum (HSZ) location: Hörsaalzentrum (HSZ) / [Livestream](https://www.youtube.com/watch?v=dQw4w9WgXcQ)
livestream: true livestream: true
- start: 18:30 - start: 18:30
@ -246,7 +246,7 @@
title: LAN-Party title: LAN-Party
description: description:
de: Ihr könnt mit euren Kommilitonen eure Lieblingsspiele zocken, und wir bestellen Pizza für euch. de: Ihr könnt mit euren Kommilitonen eure Lieblingsspiele zocken, und wir bestellen Pizza für euch.
en: en: TBA
annotation: annotation:
de: Btte bringt euren eigenen Rechner mit. de: Btte bringt euren eigenen Rechner mit.
en: Please bring your own computer. en: Please bring your own computer.

View file

@ -73,6 +73,30 @@ module.exports = function(eleventyConfig) {
return value.filter(item => item.page.lang === this.page.lang) return value.filter(item => item.page.lang === this.page.lang)
}); });
eleventyConfig.addAsyncFilter('mdInline', async function(value) {
// TODO replace with ESM import once we switch to Eleventy v3
const md = (await import('markdown-it/index.mjs')).default();
// customize link rendering
md.renderer.rules.link_open = function (tokens, idx, options, env, self) {
const href = tokens[idx].attrGet('href');
if (href.startsWith('http')) {
tokens[idx].attrSet('target', '_blank');
tokens[idx].attrSet('rel', 'noreferrer');
} else {
const newHref = eleventyConfig.javascriptFunctions.locale_url(href);
tokens[idx].attrSet('href', newHref);
}
tokens[idx].attrSet('class', 'link');
return self.renderToken(tokens, idx, options);
};
return md.renderInline(value);
});
// copy aileron font // copy aileron font
eleventyConfig.addPassthroughCopy({'./submodules/aileron/fonts/*.(ttf|woff|woff2)': 'fonts'}) eleventyConfig.addPassthroughCopy({'./submodules/aileron/fonts/*.(ttf|woff|woff2)': 'fonts'})
eleventyConfig.addPassthroughCopy({'./submodules/aileron/aileron.lite.min.css': 'aileron.lite.min.css'}) eleventyConfig.addPassthroughCopy({'./submodules/aileron/aileron.lite.min.css': 'aileron.lite.min.css'})

102
package-lock.json generated
View file

@ -15,6 +15,7 @@
"@fortawesome/fontawesome-free": "^6.6.0", "@fortawesome/fontawesome-free": "^6.6.0",
"eleventy-plugin-icons": "^4.5.1", "eleventy-plugin-icons": "^4.5.1",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"markdown-it": "^14.1.0",
"svg-text-to-path": "^2.0.3" "svg-text-to-path": "^2.0.3"
} }
}, },
@ -160,6 +161,47 @@
"url": "https://opencollective.com/11ty" "url": "https://opencollective.com/11ty"
} }
}, },
"node_modules/@11ty/eleventy/node_modules/linkify-it": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-4.0.1.tgz",
"integrity": "sha512-C7bfi1UZmoj8+PQx22XyeXCuBlokoyWQL5pWSP+EI6nzRylyThouddufc2c1NDIcP9k5agmN9fLpA7VNJfIiqw==",
"dev": true,
"license": "MIT",
"dependencies": {
"uc.micro": "^1.0.1"
}
},
"node_modules/@11ty/eleventy/node_modules/markdown-it": {
"version": "13.0.2",
"resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-13.0.2.tgz",
"integrity": "sha512-FtwnEuuK+2yVU7goGn/MJ0WBZMM9ZPgU9spqlFs7/A/pDIUNSOQZhUgOqYCficIuR2QaFnrt8LHqBWsbTAoI5w==",
"dev": true,
"license": "MIT",
"dependencies": {
"argparse": "^2.0.1",
"entities": "~3.0.1",
"linkify-it": "^4.0.1",
"mdurl": "^1.0.1",
"uc.micro": "^1.0.5"
},
"bin": {
"markdown-it": "bin/markdown-it.js"
}
},
"node_modules/@11ty/eleventy/node_modules/mdurl": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz",
"integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==",
"dev": true,
"license": "MIT"
},
"node_modules/@11ty/eleventy/node_modules/uc.micro": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz",
"integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==",
"dev": true,
"license": "MIT"
},
"node_modules/@11ty/lodash-custom": { "node_modules/@11ty/lodash-custom": {
"version": "4.17.21", "version": "4.17.21",
"resolved": "https://registry.npmjs.org/@11ty/lodash-custom/-/lodash-custom-4.17.21.tgz", "resolved": "https://registry.npmjs.org/@11ty/lodash-custom/-/lodash-custom-4.17.21.tgz",
@ -2109,13 +2151,13 @@
} }
}, },
"node_modules/linkify-it": { "node_modules/linkify-it": {
"version": "4.0.1", "version": "5.0.0",
"resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-4.0.1.tgz", "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.0.tgz",
"integrity": "sha512-C7bfi1UZmoj8+PQx22XyeXCuBlokoyWQL5pWSP+EI6nzRylyThouddufc2c1NDIcP9k5agmN9fLpA7VNJfIiqw==", "integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"uc.micro": "^1.0.1" "uc.micro": "^2.0.0"
} }
}, },
"node_modules/liquidjs": { "node_modules/liquidjs": {
@ -2164,20 +2206,34 @@
} }
}, },
"node_modules/markdown-it": { "node_modules/markdown-it": {
"version": "13.0.2", "version": "14.1.0",
"resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-13.0.2.tgz", "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.1.0.tgz",
"integrity": "sha512-FtwnEuuK+2yVU7goGn/MJ0WBZMM9ZPgU9spqlFs7/A/pDIUNSOQZhUgOqYCficIuR2QaFnrt8LHqBWsbTAoI5w==", "integrity": "sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"argparse": "^2.0.1", "argparse": "^2.0.1",
"entities": "~3.0.1", "entities": "^4.4.0",
"linkify-it": "^4.0.1", "linkify-it": "^5.0.0",
"mdurl": "^1.0.1", "mdurl": "^2.0.0",
"uc.micro": "^1.0.5" "punycode.js": "^2.3.1",
"uc.micro": "^2.1.0"
}, },
"bin": { "bin": {
"markdown-it": "bin/markdown-it.js" "markdown-it": "bin/markdown-it.mjs"
}
},
"node_modules/markdown-it/node_modules/entities": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",
"integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==",
"dev": true,
"license": "BSD-2-Clause",
"engines": {
"node": ">=0.12"
},
"funding": {
"url": "https://github.com/fb55/entities?sponsor=1"
} }
}, },
"node_modules/maximatch": { "node_modules/maximatch": {
@ -2230,9 +2286,9 @@
} }
}, },
"node_modules/mdurl": { "node_modules/mdurl": {
"version": "1.0.1", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz",
"integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==", "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==",
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
@ -2905,6 +2961,16 @@
"node": ">=6" "node": ">=6"
} }
}, },
"node_modules/punycode.js": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz",
"integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=6"
}
},
"node_modules/querystringify": { "node_modules/querystringify": {
"version": "2.2.0", "version": "2.2.0",
"resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz",
@ -3349,9 +3415,9 @@
"license": "0BSD" "license": "0BSD"
}, },
"node_modules/uc.micro": { "node_modules/uc.micro": {
"version": "1.0.6", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz",
"integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==", "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==",
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },

View file

@ -16,6 +16,7 @@
"@fortawesome/fontawesome-free": "^6.6.0", "@fortawesome/fontawesome-free": "^6.6.0",
"eleventy-plugin-icons": "^4.5.1", "eleventy-plugin-icons": "^4.5.1",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"markdown-it": "^14.1.0",
"svg-text-to-path": "^2.0.3" "svg-text-to-path": "^2.0.3"
} }
} }