Skip to content

Commit bc19f67

Browse files
committed
markdownFormat baebee
1 parent f73ea47 commit bc19f67

4 files changed

Lines changed: 13 additions & 3 deletions

File tree

.eleventy.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
const { DateTime } = require("luxon");
2+
const markdownIt = require('markdown-it')({
3+
html: true,
4+
breaks: true,
5+
linkify: true
6+
});
27

38
module.exports = function(config) {
49
const now = new Date();
@@ -17,13 +22,18 @@ module.exports = function(config) {
1722
config.addFilter("dateFormat", (value, format = "dd LLLL yyyy") => {
1823
return DateTime.fromJSDate(new Date(value)).toFormat(format);
1924
});
25+
2026
config.addFilter("w3DateFormat", (value, showTimezone = true) => {
2127
if (showTimezone) {
2228
return DateTime.fromJSDate(new Date(value)).toFormat("yyyy-MM-dd'T'HH:mm:ssZZZ");
2329
}
2430
return DateTime.fromJSDate(new Date(value)).toFormat("yyyy-MM-dd'T'HH:mm:ss");
2531
});
2632

33+
config.addFilter("markdownFormat", (value) => {
34+
return markdownIt.render(value);
35+
});
36+
2737
return {
2838
dataTemplateEngine: "njk",
2939
htmlTemplateEngine: "njk",

challenges/1.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: JavaScript Drum Kit
3-
lede: I really enjoyed starting this challenge; it was actually a great first challenge for me because I’ve had a lot of fun tinkering with interactions triggering audio events and the Web Audio API. Shout out to <a href="https://rusingh.com/articles/2020/10/07/javascript30-02-wes-bos-course-grouping-operator-hoc/">Ru Singh</a> for putting this on my radar and giving me the push to make it a daily challenge for me!
3+
lede: I really enjoyed starting this challenge; it was actually a great first challenge for me because I’ve had a lot of fun tinkering with interactions triggering audio events and the Web Audio API. Shout out to [Ru Singh](https://rusingh.com/articles/2020/10/07/javascript30-02-wes-bos-course-grouping-operator-hoc/) for putting this on my radar and giving me the push to make it a daily challenge for me!
44
date: 2020-10-07T12:00:00+0000
55
---
66
<!DOCTYPE html>

challenges/2.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: CSS + JS Clock
3-
lede: Not quite as challenging as as <a href="/1/">the first</a>, but nice to refresh myself with the Date object.
3+
lede: Not quite as challenging as as [the first](/1/), but nice to refresh myself with the Date object.
44
date: 2020-10-08T12:00:00+0000
55
---
66
<!DOCTYPE html>

index.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ color: "#5f8aa6"
5353
<article class="[ h-entry ]">
5454
<h3><a class="p-name" href="{{ item.url }}"><small>{{ loop.length - loop.index0 }}.</small> {{ item.data.title }}</a></h3>
5555
{% if item.data.lede %}
56-
<p class="p-summary">{{ item.data.lede | safe }}</p>
56+
<p class="p-summary">{{ item.data.lede | markdownFormat | safe }}</p>
5757
{% endif %}
5858
<div class="[ deck__meta ]">
5959
<small>published</small>

0 commit comments

Comments
 (0)