Skip to content

Commit

Permalink
change from highlightjs to prismjs
Browse files Browse the repository at this point in the history
  • Loading branch information
alifeee committed Dec 4, 2024
1 parent ba72dcf commit 6e24e05
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
10 changes: 8 additions & 2 deletions notes/_build/.eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ export default function (eleventyConfig) {
eleventyConfig.addPassthroughCopy({ "../../*.js": copy_to });
eleventyConfig.addPassthroughCopy({ "../../*.png": copy_to });
eleventyConfig.addPassthroughCopy({ "./*.xsl": copy_to });
eleventyConfig.addPassthroughCopy({
"../../prism-components/*": "/prism-components/",
});

const markdownLib = markdownIt({ html: true }).use(markdownItAnchor);
eleventyConfig.setLibrary("md", markdownLib);
Expand Down Expand Up @@ -171,6 +174,9 @@ export default function (eleventyConfig) {
if (limit == -1) return array;
return array.slice(0, limit);
});
eleventyConfig.addFilter("dev", () => {
return process.env.ELEVENTY_RUN_MODE != "build";
});

// wordcount - probably pass "page.rawInput"
eleventyConfig.addFilter("wordcount", (content) => {
Expand All @@ -186,7 +192,7 @@ export default function (eleventyConfig) {
}

export const config = {
pathPrefix: process.env.ELEVENTY_RUN_MODE == "build" ? "/notes/" : "/",
// pathPrefix: "test",
// pathPrefix: process.env.ELEVENTY_RUN_MODE == "build" ? "/notes/" : "/",
pathPrefix: "/notes/",
markdownTemplateEngine: false,
};
11 changes: 7 additions & 4 deletions notes/_includes/page.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@
<link rel="icon" type="image/png" href="/og-image.png" />
<link rel="stylesheet" href='/picnic.css'>

<link rel="stylesheet" href='/highlight.min.css'>
<script src="/highlight.min.js"></script>

<script>hljs.highlightAll();</script>
<!-- prismjs for code highlighting -->
<link rel="stylesheet" href="/prism.min.css" />
<script src="/prism.min.js"></script>
<script src="/prism-autoloader.min.js"></script>
<script>
Prism.plugins.autoloader.languages_path = "{{#unless dev}}/notes{{/unless}}/prism-components/";
</script>

<style>
header {
Expand Down

0 comments on commit 6e24e05

Please sign in to comment.