Skip to content

Instantly share code, notes, and snippets.

@Narottam04
Last active May 2, 2021 10:01
Show Gist options
  • Save Narottam04/1f811dc699f1a5565e059bda161ad8ec to your computer and use it in GitHub Desktop.
Save Narottam04/1f811dc699f1a5565e059bda161ad8ec to your computer and use it in GitHub Desktop.
module.exports = function (eleventyConfig) {
eleventyConfig.addPassthroughCopy("images");
eleventyConfig.addPassthroughCopy("admin");
eleventyConfig.addPassthroughCopy("CSS");
eleventyConfig.addPassthroughCopy("Javascript");
eleventyConfig.addWatchTarget("images");
eleventyConfig.addWatchTarget("admin");
eleventyConfig.addWatchTarget("CSS");
eleventyConfig.addWatchTarget("Javascript");
// plugin to add target and rel to a tags
// let markdownIt = require("markdown-it");
// let markdownItOptions = {
// html: true
// };
// let mila = require("markdown-it-link-attributes");
// let milaOptions = {
// attrs: {
// target: "_blank",
// rel: "noopener noreferrer"
// }
// };
// let markdownLib = markdownIt(markdownItOptions).use(mila, milaOptions);
// eleventyConfig.setLibrary("md", markdownLib);
// lazy image optimization
// const lazy_loading = require('markdown-it-image-lazy-loading');
// let lazyLoad = markdownIt(markdownItOptions).use(lazy_loading);
// eleventyConfig.setLibrary("md", lazyLoad)
let markdownIt = require("markdown-it");
let markdownItOptions = {
html: true
};
const markdownItPlugins = ["markdown-it-image-lazy-loading", "markdown-it-link-attributes"];
const markdownLibrary = markdownItPlugins.reduce(
(m, plugin) => m.use(require(plugin)),
markdownIt(markdownItOptions)
);
eleventyConfig.setLibrary("md", markdownLibrary)
}
{
"name": "WEBDRIP-BLOG",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "eleventy --serve",
"build": "eleventy"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@11ty/eleventy": "^0.12.1",
"markdown-it-for-inline": "^0.1.1",
"markdown-it-image-lazy-loading": "^1.1.0",
"markdown-it-link-attributes": "^3.0.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment