Add a "raw" file template, which shows the plain text of a file

8559a132c4d0d70fe0d5ad2ae5d19749f0e8f3e2

Tucker McKnight | Sun Oct 12 2025

Add a "raw" file template, which shows the plain text of a file

Add a link to said raw file when viewing the file in the Files
tab.

Also remove an unnecessary "async" from a filter that was not
async.

Also .gitignore the docs directory, which gets generated when
`npm run build` is run.
.gitignore:2
Before
2
After
2
docs
main.ts:201
Before
201
  eleventyConfig.addAsyncFilter("isDirectory", async(filename, repoName, branchName) => {
After
201
  eleventyConfig.addFilter("isDirectory", (filename, repoName, branchName) => {
main.ts:322
Before
322
After
322
  // RAW.NJK
  const rawTemplate = fsImport.readFileSync(`${import.meta.dirname}/templates/raw.njk`).toString()
  eleventyConfig.addTemplate(
    'repos/raw.njk',
    rawTemplate,
    {
      pagination: {
        data: "flatFiles",
        size: 1,
        alias: "fileInfo",
      },
      eleventyAllowMissingExtension: true,
      flatFiles: flatFilesData,
      permalink: (data) => {
        const repoName = data.fileInfo.repoName
        const branchName = data.fileInfo.branchName
        return `${reposPath}/${eleventyConfig.getFilter("slugify")(repoName)}/branches/${eleventyConfig.getFilter("slugify")(branchName)}/raw/${eleventyConfig.getFilter("slugify")(data.fileInfo.file)}`
      },
    }
  )
templates/file.njk:15
Before
15
  <div class="col">
After
15
  <div class="col-auto">
  <div class="col">
    <a href="{{reposPath}}/{{fileInfo.repoName | slugify}}/branches/{{fileInfo.branchName | slugify}}/raw/{{fileInfo.file | slugify}}">View raw file</a>
  </div>