const navigationPlugin = require("@11ty/eleventy-navigation")
const syntaxHighlightingPlugin = require("@11ty/eleventy-plugin-syntaxhighlight")

module.exports = function(eleventyConfig) {
  eleventyConfig.addPlugin(navigationPlugin)
  eleventyConfig.addPlugin(syntaxHighlightingPlugin)

  eleventyConfig.addPassthroughCopy("assets")
  eleventyConfig.addPassthroughCopy("fonts")

  eleventyConfig.addShortcode("fas_icon", function(name) { return `<span class="fas fa-${name}"></span>` })
  
  // List of icons: https://codeberg.org/Codeberg/gitea/src/branch/codeberg/public/img/svg
  eleventyConfig.addShortcode("gitea_icon", function(name) { 
    const fetch = require('node-fetch');
    fetch(`https://codeberg.org/img/svg/${name}.svg`)
    .then(res => res.text())
    .then(body => {return svg = body;});
    return svg 
  })

  return {
    dir: {
      input: "content"
    }
  }
}
