Branch

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

Sat Oct 11 2025

Tucker McKnight <tucker@pangolin.lan>

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.

8559a132c4d0d70fe0d5ad2ae5d19749f0e8f3e2

Side-by-side
Stacked
.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 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342
  // 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 16 17 18
  <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>