summaryrefslogtreecommitdiff
path: root/src/build
diff options
context:
space:
mode:
Diffstat (limited to 'src/build')
-rw-r--r--src/build/article.mjs12
-rw-r--r--src/build/i18n.mjs94
-rw-r--r--src/build/index.mjs108
-rw-r--r--src/build/load-svg.mjs10
-rw-r--r--src/build/remove-footnote-header.mjs11
-rw-r--r--src/build/rss.mjs33
-rw-r--r--src/build/special_box.mjs35
-rw-r--r--src/build/to-html.mjs68
-rw-r--r--src/build/utils.mjs7
9 files changed, 208 insertions, 170 deletions
diff --git a/src/build/article.mjs b/src/build/article.mjs
index 1a7b09b..fc9a2f9 100644
--- a/src/build/article.mjs
+++ b/src/build/article.mjs
@@ -14,11 +14,17 @@ function getArticleYear(article) {
function getArticleDate(article) {
if (article.metaData.pubDate.getDate) {
- return article.metaData.pubDate.getFullYear() * 100 + article.metaData.pubDate.getDate();
+ return (
+ article.metaData.pubDate.getFullYear() * 100 +
+ article.metaData.pubDate.getDate()
+ );
}
if (article.metaData.pubDate.getUTCDate) {
- return article.metaData.pubDate.getUTCFullYear() * 100 + article.metaData.pubDate.getDate();
+ return (
+ article.metaData.pubDate.getUTCFullYear() * 100 +
+ article.metaData.pubDate.getDate()
+ );
}
return 0;
@@ -28,4 +34,4 @@ function cmpArticles(a, b) {
return getArticleDate(b) - getArticleDate(a);
}
-export {getArticleDate, getArticleYear, cmpArticles};
+export { getArticleDate, getArticleYear, cmpArticles };
diff --git a/src/build/i18n.mjs b/src/build/i18n.mjs
index d1cebe6..b348c09 100644
--- a/src/build/i18n.mjs
+++ b/src/build/i18n.mjs
@@ -1,76 +1,85 @@
-
const i18n = {
fr: {
intro: {
- 'description': 'Éternel étudiant en Math-Info.',
- 'about': 'Autodidacte passionné,<br><span class="type_wrap"><span class="type">désormais ingénieur.</span></span>',
- 'about_tags': 'GNU\\Linux, C, C++, Python, Math, autohébergement, décentralisation, P2P, commun, ... <br> ',
+ description: "Éternel étudiant en Math-Info.",
+ about:
+ 'Autodidacte passionné,<br><span class="type_wrap"><span class="type">désormais ingénieur.</span></span>',
+ about_tags:
+ "GNU\\Linux, C, C++, Python, Math, autohébergement, décentralisation, P2P, commun, ... <br> ",
},
title: {
- 'main': 'ache: Blog personnel',
- 'home': 'L\'accueil',
- 'git': 'Dépôt git personnel',
- 'mastodon': 'Mon mastodon',
+ main: "ache: Blog personnel",
+ home: "L'accueil",
+ git: "Dépôt git personnel",
+ mastodon: "Mon mastodon",
},
articles: [
- 'framasoft-et-les-mascottes-du-libre.md',
- 'les-trains-et-la-publicité.md',
- 'formats-images-web.md',
- 'bizarreries-du-langage-c.md',
- 'retour-sur-laoc-2021-semaine-1.md',
- '2FA-discord-sur-pc.md',
- 'duckduckgo-google-en-mieux.md',
+ "framasoft-et-les-mascottes-du-libre.md",
+ "les-trains-et-la-publicité.md",
+ "formats-images-web.md",
+ "bizarreries-du-langage-c.md",
+ "retour-sur-laoc-2021-semaine-1.md",
+ "2FA-discord-sur-pc.md",
+ "duckduckgo-google-en-mieux.md",
],
rss: {
- 'title': 'ache: Blog personnel',
- 'quick_description': 'Programmation, Algorithmique, Système, *pick you poison*',
- 'description': `<b>Ceci est un flux RSS</b> à destination des agrégateurs de contenu.<br>\nEn tant qu'être humain vous cherchez certainement <a href="https://ache.one/fr/">mon site web</a>.`
+ title: "ache: Blog personnel",
+ quick_description:
+ "Programmation, Algorithmique, Système, *pick you poison*",
+ description: `<b>Ceci est un flux RSS</b> à destination des agrégateurs de contenu.<br>\nEn tant qu'être humain vous cherchez certainement <a href="https://ache.one/fr/">mon site web</a>.`,
},
toc_keyword: "Sommaire",
tag_desc: "Liste des articles ayant le tag",
- index_desc: "Blog personnel à propos de programmation, logiciel libre et autohébergement. Essayons de rendre le monde meilleur.",
+ index_desc:
+ "Blog personnel à propos de programmation, logiciel libre et autohébergement. Essayons de rendre le monde meilleur.",
like_title: "Si vous avez aimez cet article cliquez sur le cœur !",
- like_text: "Vous pouvez même envoyez plusieurs cœurs ! <br><span class=\"likesNotes\">Le délais d'attente entre deux cœurs double à chaque fois.</span>",
+ like_text:
+ 'Vous pouvez même envoyez plusieurs cœurs ! <br><span class="likesNotes">Le délais d\'attente entre deux cœurs double à chaque fois.</span>',
},
en: {
intro: {
- 'description': 'Eternal student in computer science.',
- 'quick_description': 'Programmation, Algorithmique, Système, *pick you poison*',
- 'about': 'Self-taught developper,<br><span class="type_wrap"><span class="type">now engineer.</span></span>',
- 'about_tags': 'GNU\\Linux, C, C++, Python, Math, self-hosted, dececntralisation, P2P, ... <br>',
+ description: "Eternal student in computer science.",
+ quick_description:
+ "Programmation, Algorithmique, Système, *pick you poison*",
+ about:
+ 'Self-taught developper,<br><span class="type_wrap"><span class="type">now engineer.</span></span>',
+ about_tags:
+ "GNU\\Linux, C, C++, Python, Math, self-hosted, dececntralisation, P2P, ... <br>",
},
title: {
- 'main': 'ache: Personal blog',
- 'home': 'Home',
- 'git': 'Personnel git repository',
- 'mastodon': 'Mastodon account',
+ main: "ache: Personal blog",
+ home: "Home",
+ git: "Personnel git repository",
+ mastodon: "Mastodon account",
},
articles: [
- 'rail-and-advertising.md',
- 'web-image-formats.md',
- 'c-language-quirks.md',
+ "rail-and-advertising.md",
+ "web-image-formats.md",
+ "c-language-quirks.md",
],
rss: {
- 'title': 'ache: Personal blog',
- 'description': `<b>This is a RSS feed</b> for content agreagator.<br>\nAs a human being, you are certainly looking for <a href="https://ache.one/en/">my website</a>.`
+ title: "ache: Personal blog",
+ description: `<b>This is a RSS feed</b> for content agreagator.<br>\nAs a human being, you are certainly looking for <a href="https://ache.one/en/">my website</a>.`,
},
toc_keyword: "Table of contents",
tag_desc: "List of articles with the tag",
- index_desc: "Personal blog about programming, free software and self-hosting. Let's try to make the world a better place.",
+ index_desc:
+ "Personal blog about programming, free software and self-hosting. Let's try to make the world a better place.",
like_title: "If you liked this article click on the heart!",
- like_text: "You can even send multiple hearts! <br><span class=\"likesNotes\">The waiting time between two hearts doubles each time.</span>",
- }
-}
+ like_text:
+ 'You can even send multiple hearts! <br><span class="likesNotes">The waiting time between two hearts doubles each time.</span>',
+ },
+};
const lang_desc = {
fr: "Version Française",
en: "English version",
-}
+};
export function addDescription(alt_lang) {
if (alt_lang) {
- alt_lang.forEach(e => {
- e.description = lang_desc[e.lang]
+ alt_lang.forEach((e) => {
+ e.description = lang_desc[e.lang];
});
}
@@ -78,8 +87,9 @@ export function addDescription(alt_lang) {
}
export function getTocHeading() {
- return Object.entries(i18n).map(([_, v]) => v.toc_keyword).join('|');
+ return Object.entries(i18n)
+ .map(([_, v]) => v.toc_keyword)
+ .join("|");
}
-
export default i18n;
diff --git a/src/build/index.mjs b/src/build/index.mjs
index a14cdc7..cb918b7 100644
--- a/src/build/index.mjs
+++ b/src/build/index.mjs
@@ -1,26 +1,25 @@
-import process from 'node:process';
-import fs from 'node:fs';
-import mustache from 'mustache';
-import loadSVG from './load-svg.mjs';
-import getRSS from './rss.mjs';
-import loadMD from './loadMD.mjs';
-import {cmpArticles} from './article.mjs';
-import i18n from './i18n.mjs';
-import {addDescription} from './i18n.mjs';
-import {minifyHTML} from './utils.mjs';
-
-import { SitemapStream, streamToPromise } from 'sitemap'
-import { Readable } from 'stream'
-
-
-const leftPanelTmpl = fs.readFileSync('src/templates/left.tmpl', 'utf8');
-const likesTmpl = fs.readFileSync('src/templates/likes.tmpl', 'utf8');
-const headerTmpl = fs.readFileSync('src/templates/header.tmpl', 'utf8');
-const articleTmpl = fs.readFileSync('src/templates/article.tmpl', 'utf8');
-const indexTmpl = fs.readFileSync('src/templates/index.tmpl', 'utf8');
-const tagTmpl = fs.readFileSync('src/templates/tag.tmpl', 'utf8');
-const hidTmpl = fs.readFileSync('src/templates/hid.tmpl', 'utf8');
-const baseUrl = 'https://ache.one/';
+import process from "node:process";
+import fs from "node:fs";
+import mustache from "mustache";
+import loadSVG from "./load-svg.mjs";
+import getRSS from "./rss.mjs";
+import loadMD from "./loadMD.mjs";
+import { cmpArticles } from "./article.mjs";
+import i18n from "./i18n.mjs";
+import { addDescription } from "./i18n.mjs";
+import { minifyHTML } from "./utils.mjs";
+
+import { SitemapStream, streamToPromise } from "sitemap";
+import { Readable } from "stream";
+
+const leftPanelTmpl = fs.readFileSync("src/templates/left.tmpl", "utf8");
+const likesTmpl = fs.readFileSync("src/templates/likes.tmpl", "utf8");
+const headerTmpl = fs.readFileSync("src/templates/header.tmpl", "utf8");
+const articleTmpl = fs.readFileSync("src/templates/article.tmpl", "utf8");
+const indexTmpl = fs.readFileSync("src/templates/index.tmpl", "utf8");
+const tagTmpl = fs.readFileSync("src/templates/tag.tmpl", "utf8");
+const hidTmpl = fs.readFileSync("src/templates/hid.tmpl", "utf8");
+const baseUrl = "https://ache.one/";
const partials = {
header: headerTmpl,
@@ -37,8 +36,11 @@ let links = [];
for (const lang in i18n) {
const tagsArticle = new Map();
const filter = process.argv.slice(2);
- const listArticle = (filter.length > 0) ? i18n[lang].articles.filter((article) => filter.includes(article.name)) : i18n[lang].articles;
- const articles = loadMD(listArticle, 'articles', lang);
+ const listArticle =
+ filter.length > 0
+ ? i18n[lang].articles.filter((article) => filter.includes(article.name))
+ : i18n[lang].articles;
+ const articles = loadMD(listArticle, "articles", lang);
for (const article of articles) {
const context = {
@@ -61,7 +63,12 @@ for (const lang in i18n) {
console.log(`Create : ${article.title}`);
fs.writeFileSync(`articles/${article.name}.html`, minifyHTML(output));
- links.push({url: context.canonical, changefreq: 'yearly', priority: 0.6, img: [{url: article.imageUrl}]})
+ links.push({
+ url: context.canonical,
+ changefreq: "yearly",
+ priority: 0.6,
+ img: [{ url: article.imageUrl }],
+ });
for (const tag of article.metaData.tags) {
if (tagsArticle.has(tag)) {
@@ -72,12 +79,12 @@ for (const lang in i18n) {
}
}
-// Set of pages language dependant
+ // Set of pages language dependant
try {
- fs.mkdirSync(`${lang}/tag`, {recursive: true});
+ fs.mkdirSync(`${lang}/tag`, { recursive: true });
} catch {
- fs.rmSync(`${lang}/tag`, {force: true, recursive: true});
- fs.mkdirSync(`${lang}/tag`, {recursive: true});
+ fs.rmSync(`${lang}/tag`, { force: true, recursive: true });
+ fs.mkdirSync(`${lang}/tag`, { recursive: true });
}
for (const [tag, articles] of tagsArticle.entries()) {
@@ -92,28 +99,36 @@ for (const lang in i18n) {
lang,
tag,
articles,
- description: `${i18n[lang]['tag_desc']} ${tag}.`,
+ description: `${i18n[lang]["tag_desc"]} ${tag}.`,
};
const output = mustache.render(tagTmpl, context, partials);
fs.writeFileSync(`${lang}/tag/${tag}.html`, minifyHTML(output));
- links.push({url: `${baseUrl}${lang}/tag/${tag}`, changefreq: 'monthly', priority: 0.3})
+ links.push({
+ url: `${baseUrl}${lang}/tag/${tag}`,
+ changefreq: "monthly",
+ priority: 0.3,
+ });
}
console.log(`Create RSS Flux: ${lang}/rss.xml`);
const xmlFeed = getRSS(articles, baseUrl, lang);
fs.writeFileSync(`${lang}/rss.xml`, xmlFeed);
- links.push({url: `${baseUrl}${lang}/rss.xml`, changefreq: 'monthly', priority: 0.3})
+ links.push({
+ url: `${baseUrl}${lang}/rss.xml`,
+ changefreq: "monthly",
+ priority: 0.3,
+ });
{
const alt_lang = {
fr: {
- lang: 'en',
- url: '/en/',
+ lang: "en",
+ url: "/en/",
},
en: {
- lang: 'fr',
- url: '/fr/',
+ lang: "fr",
+ url: "/fr/",
},
};
const context = {
@@ -131,20 +146,21 @@ for (const lang in i18n) {
console.log(`Create : Home page ${lang}`);
const output = mustache.render(indexTmpl, context, partials);
fs.writeFileSync(`${lang}/index.html`, minifyHTML(output));
- links.push({url: `${baseUrl}${lang}`, changefreq: 'monthly', priority: 0.7, img: [{url: "https://ache.one/res/ache.svg"}]})
+ links.push({
+ url: `${baseUrl}${lang}`,
+ changefreq: "monthly",
+ priority: 0.7,
+ img: [{ url: "https://ache.one/res/ache.svg" }],
+ });
}
}
console.log(`Create: sitemap.xml`);
// Create a stream to write to
-const stream = new SitemapStream({hostname: 'https://ache.one'});
+const stream = new SitemapStream({ hostname: "https://ache.one" });
// Return a promise that resolves with your XML string
-streamToPromise(
- Readable.from(links)
- .pipe(stream))
- .then(data => data.toString())
- .then(sitemapXML => fs.writeFileSync("sitemap.xml", sitemapXML)
-);
-
+streamToPromise(Readable.from(links).pipe(stream))
+ .then((data) => data.toString())
+ .then((sitemapXML) => fs.writeFileSync("sitemap.xml", sitemapXML));
diff --git a/src/build/load-svg.mjs b/src/build/load-svg.mjs
index 6bf8db4..eb7bf3c 100644
--- a/src/build/load-svg.mjs
+++ b/src/build/load-svg.mjs
@@ -1,12 +1,12 @@
-import fs from 'node:fs';
+import fs from "node:fs";
const loadSVG = () => {
const svg = {};
- for (const file of fs.readdirSync('s/imgM')) {
- if (file.endsWith('.svg')) {
- const contentFile = fs.readFileSync(`s/imgM/${file}`, 'utf8');
- const name = file.slice(0, -'.svg'.length);
+ for (const file of fs.readdirSync("s/imgM")) {
+ if (file.endsWith(".svg")) {
+ const contentFile = fs.readFileSync(`s/imgM/${file}`, "utf8");
+ const name = file.slice(0, -".svg".length);
svg[name] = contentFile;
}
}
diff --git a/src/build/remove-footnote-header.mjs b/src/build/remove-footnote-header.mjs
index a238692..95f481b 100644
--- a/src/build/remove-footnote-header.mjs
+++ b/src/build/remove-footnote-header.mjs
@@ -1,17 +1,16 @@
-import {visit} from 'unist-util-visit';
+import { visit } from "unist-util-visit";
// This plugin is an example to let users write HTML with directives.
// It’s informative but rather useless.
// See below for others examples.
/** @type {import('unified').Plugin<[], import('mdast').Root>} */
export default function specialBox() {
- return tree => {
- visit(tree, node => {
- if (node?.tagName === 'h2' && node?.properties?.id === 'footnote-label') {
- node.tagName = 'hr';
+ return (tree) => {
+ visit(tree, (node) => {
+ if (node?.tagName === "h2" && node?.properties?.id === "footnote-label") {
+ node.tagName = "hr";
node.children = []; // Exposure of children, Roman's way
}
});
};
}
-
diff --git a/src/build/rss.mjs b/src/build/rss.mjs
index 6394af5..73b7803 100644
--- a/src/build/rss.mjs
+++ b/src/build/rss.mjs
@@ -1,14 +1,14 @@
-import RSS from 'rss';
-import i18n from './i18n.mjs';
+import RSS from "rss";
+import i18n from "./i18n.mjs";
const getRSS = (articles, baseUrl, lang) => {
- console.log(i18n[lang]['rss']['title']);
+ console.log(i18n[lang]["rss"]["title"]);
const rssFeed = new RSS({
- title: i18n[lang]['rss']['title'],
- description: i18n[lang]['rss']['description'],
+ title: i18n[lang]["rss"]["title"],
+ description: i18n[lang]["rss"]["description"],
// eslint-disable-next-line camelcase
custom_namespaces: {
- 'visible_description': i18n[lang]['rss']['description']
+ visible_description: i18n[lang]["rss"]["description"],
},
site_url: "https://ache.one",
feed_url: `${baseUrl}rss.xml`,
@@ -19,31 +19,34 @@ const getRSS = (articles, baseUrl, lang) => {
image_url: `${baseUrl}ache.svg`,
language: lang,
pubDate: Date(),
- ttl: '1440',
+ ttl: "1440",
});
for (const article of articles.slice(0, 10)) {
- let image_url = (article.imageUrl[0] != '/') ? `/${article.imageUrl}` : article.imageUrl;
+ let image_url =
+ article.imageUrl[0] != "/" ? `/${article.imageUrl}` : article.imageUrl;
rssFeed.item({
title: article.title,
- description: '<article>' + article.content + '</article>',
+ description: "<article>" + article.content + "</article>",
// eslint-disable-next-line camelcase
image_url,
url: `${baseUrl}articles/${article.name}`,
guid: article.domTitle,
- author: 'ache',
+ author: "ache",
date: article.metaData.pubDateISO,
categories: article.metaData.tags,
// eslint-disable-next-line camelcase
- custom_elements: [
- {logo: image_url},
- {intro: article.introDesc},
- ],
+ custom_elements: [{ logo: image_url }, { intro: article.introDesc }],
});
}
- return rssFeed.xml({indent: false}).replace(/<\?xml version="1.0" encoding="UTF-8"\?>/g, '<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="/style.xsl"?>');
+ return rssFeed
+ .xml({ indent: false })
+ .replace(
+ /<\?xml version="1.0" encoding="UTF-8"\?>/g,
+ '<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="/style.xsl"?>',
+ );
};
export default getRSS;
diff --git a/src/build/special_box.mjs b/src/build/special_box.mjs
index 1457a98..f1631b6 100644
--- a/src/build/special_box.mjs
+++ b/src/build/special_box.mjs
@@ -1,39 +1,40 @@
-import {visit} from 'unist-util-visit';
+import { visit } from "unist-util-visit";
// This plugin is an example to let users write HTML with directives.
// It’s informative but rather useless.
// See below for others examples.
/** @type {import('unified').Plugin<[], import('mdast').Root>} */
export default function specialBox() {
- return tree => {
- visit(tree, node => {
- if (node.type === 'containerDirective' && (
- node.name === 'attention'
- || node.name === 'question'
- || node.name === 'note'
- || node.name === 'information')) {
+ return (tree) => {
+ visit(tree, (node) => {
+ if (
+ node.type === "containerDirective" &&
+ (node.name === "attention" ||
+ node.name === "question" ||
+ node.name === "note" ||
+ node.name === "information")
+ ) {
const data = node.data || (node.data = {});
- data.hName = 'div';
+ data.hName = "div";
data.hProperties = {
- className: 'special-box ' + node.name,
+ className: "special-box " + node.name,
};
}
- if (node.type === 'containerDirective' && node.name === 'details') {
- if(node.children.length > 0 && node.children[0].type == "paragraph") {
+ if (node.type === "containerDirective" && node.name === "details") {
+ if (node.children.length > 0 && node.children[0].type == "paragraph") {
node.children[0] = {
type: "containerDirective",
data: {
- hName: 'summary'
+ hName: "summary",
},
- children: node.children[0].children
+ children: node.children[0].children,
};
- const data = node.data || (node.data = {});
- data.hName = 'details';
+ const data = node.data || (node.data = {});
+ data.hName = "details";
}
}
});
};
}
-
diff --git a/src/build/to-html.mjs b/src/build/to-html.mjs
index 786f91d..5c08242 100644
--- a/src/build/to-html.mjs
+++ b/src/build/to-html.mjs
@@ -1,43 +1,43 @@
-import {unified} from 'unified';
-import remarkParse from 'remark-parse';
-import remarkGfm from 'remark-gfm';
-import remarkToc from 'remark-toc';
-import remarkDirective from 'remark-directive';
-import remarkMath from 'remark-math';
-import remarkFrontmatter from 'remark-frontmatter';
-import remarkRehype from 'remark-rehype';
-import rehypeSlug from 'rehype-slug';
-import rehypePicture from 'rehype-picture'
-import rehypeKaTeX from 'rehype-katex';
-import rehypeRaw from 'rehype-raw';
-import rehypeAutolinkHeadings from 'rehype-autolink-headings';
-import rehypeStringify from 'rehype-stringify';
-import rehypeHighlight from 'rehype-highlight';
-import remarkSpecialBox from './special_box.mjs';
-import remarkRemoveFootnoteHeader from './remove-footnote-header.mjs';
-import {getTocHeading} from './i18n.mjs';
+import { unified } from "unified";
+import remarkParse from "remark-parse";
+import remarkGfm from "remark-gfm";
+import remarkToc from "remark-toc";
+import remarkDirective from "remark-directive";
+import remarkMath from "remark-math";
+import remarkFrontmatter from "remark-frontmatter";
+import remarkRehype from "remark-rehype";
+import rehypeSlug from "rehype-slug";
+import rehypePicture from "rehype-picture";
+import rehypeKaTeX from "rehype-katex";
+import rehypeRaw from "rehype-raw";
+import rehypeAutolinkHeadings from "rehype-autolink-headings";
+import rehypeStringify from "rehype-stringify";
+import rehypeHighlight from "rehype-highlight";
+import remarkSpecialBox from "./special_box.mjs";
+import remarkRemoveFootnoteHeader from "./remove-footnote-header.mjs";
+import { getTocHeading } from "./i18n.mjs";
const autoLinkOption = {
- behavior: 'wrap',
+ behavior: "wrap",
properties: {
tabIndex: 0,
- className: 'anchor',
+ className: "anchor",
},
};
const pictureOptions = {
- 'png': {avif: 'image/avif'}
-}
+ png: { avif: "image/avif" },
+};
const generator = unified()
.use(remarkParse)
.use(remarkGfm)
- .use(remarkToc, {heading: getTocHeading(), tight: true, ordered: true})
+ .use(remarkToc, { heading: getTocHeading(), tight: true, ordered: true })
.use(remarkMath)
.use(remarkDirective)
.use(remarkSpecialBox)
- .use(remarkFrontmatter, {type: 'toml', marker: '-'})
- .use(remarkRehype, {allowDangerousHtml: true})
+ .use(remarkFrontmatter, { type: "toml", marker: "-" })
+ .use(remarkRehype, { allowDangerousHtml: true })
.use(rehypeRaw)
.use(remarkRemoveFootnoteHeader)
.use(rehypePicture, pictureOptions)
@@ -50,14 +50,14 @@ const generator = unified()
const generatorMd = unified()
.use(remarkParse)
.use(remarkGfm)
- .use(remarkToc, {heading: getTocHeading(), tight: true, ordered: true})
+ .use(remarkToc, { heading: getTocHeading(), tight: true, ordered: true })
.use(remarkMath)
.use(remarkDirective)
.use(remarkSpecialBox)
- .use(remarkFrontmatter, {type: 'toml', marker: '-'});
+ .use(remarkFrontmatter, { type: "toml", marker: "-" });
const generatorHTML = unified()
- .use(remarkRehype, {allowDangerousHtml: true})
+ .use(remarkRehype, { allowDangerousHtml: true })
.use(rehypeRaw)
.use(remarkRemoveFootnoteHeader)
.use(rehypePicture, pictureOptions)
@@ -67,11 +67,13 @@ const generatorHTML = unified()
.use(rehypeAutolinkHeadings, autoLinkOption)
.use(rehypeStringify);
-const toHtml = content => generator.processSync(content);
+const toHtml = (content) => generator.processSync(content);
-export const toMdRaw = content => generatorMd.runSync(generatorMd.parse(content));
-export const mdToHtmlRaw = content => generatorHTML.runSync(content);
+export const toMdRaw = (content) =>
+ generatorMd.runSync(generatorMd.parse(content));
+export const mdToHtmlRaw = (content) => generatorHTML.runSync(content);
-export const toHtmlRaw = content => generator.runSync(generator.parse(content));
-export const toString = content => generator.stringify(content);
+export const toHtmlRaw = (content) =>
+ generator.runSync(generator.parse(content));
+export const toString = (content) => generator.stringify(content);
export default toHtml;
diff --git a/src/build/utils.mjs b/src/build/utils.mjs
index fa85ee6..f76f74c 100644
--- a/src/build/utils.mjs
+++ b/src/build/utils.mjs
@@ -1,10 +1,11 @@
-import { minify } from 'html-minifier';
+import { minify } from "html-minifier";
-export const minifyHTML = (html) => minify(html, {
+export const minifyHTML = (html) =>
+ minify(html, {
removeAttributeQuotes: true,
removeComments: true,
minifyJS: true,
minifyCSS: true,
collapseWhitespace: true,
collapseBooleanAttributes: true,
-})
+ });