done
This commit is contained in:
parent
0314b6a427
commit
16128c6279
53 changed files with 713 additions and 75 deletions
|
@ -1,9 +1,27 @@
|
|||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const md = require("markdown-it");
|
||||
const mdAnchor = require("markdown-it-anchor");
|
||||
const mdFootnote = require("markdown-it-footnote");
|
||||
const prettier = require("prettier");
|
||||
|
||||
module.exports = (config) => {
|
||||
const slugify = config.getFilter("slugify");
|
||||
const url = config.getFilter("url");
|
||||
const mdLib = md({
|
||||
html: true,
|
||||
breaks: true,
|
||||
linkify: true,
|
||||
typographer: true,
|
||||
})
|
||||
.use(mdAnchor, {
|
||||
permalink: mdAnchor.permalink.ariaHidden({
|
||||
placement: "before",
|
||||
symbol: "",
|
||||
}),
|
||||
})
|
||||
.use(mdFootnote)
|
||||
config.setLibrary("md", mdLib);
|
||||
config.addPassthroughCopy("assets");
|
||||
|
||||
// collection from music folder
|
||||
|
@ -22,7 +40,7 @@ module.exports = (config) => {
|
|||
return {
|
||||
data: {
|
||||
title: base,
|
||||
tags: ['music'],
|
||||
tags: ["music"],
|
||||
},
|
||||
url: url(absUrl),
|
||||
};
|
||||
|
@ -30,6 +48,23 @@ module.exports = (config) => {
|
|||
return musicFiles;
|
||||
});
|
||||
|
||||
config.addTransform("prettier", (content, outputPath) => {
|
||||
if (typeof outputPath !== 'string') {
|
||||
return content
|
||||
}
|
||||
const extname = path.extname(outputPath);
|
||||
switch (extname) {
|
||||
case ".html":
|
||||
case ".css":
|
||||
case ".json":
|
||||
// Strip leading period from extension and use as the Prettier parser.
|
||||
const parser = extname.replace(/^./, "");
|
||||
return prettier.format(content, { parser });
|
||||
default:
|
||||
return content;
|
||||
}
|
||||
})
|
||||
|
||||
return {
|
||||
dir: {
|
||||
input: "site",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue