Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

manuscript-theme

A shared pandoc template + CSS + GitHub Actions build, for publishing plain .md manuscripts to GitHub Pages without Quarto. Point any manuscript repo's workflow at this one and it gets the same look, the same pandoc invocation, and the same fixes for pandoc's markdown-parsing gotchas (see "Why this exists" below).

Using it in a manuscript repo

  1. In the manuscript repo, add .github/workflows/publish.yml:

    name: Build and deploy manuscript site
    on:
      push:
        branches: [main]   # match your repo's actual default branch name
        paths:
          - "**/*.md"
          - "**/*.meta.yml"
          - "media/**"
      workflow_dispatch: {}
    
    permissions:
      contents: read
      pages: write
      id-token: write
    
    # Do NOT add a `concurrency:` block here. This reusable workflow
    # already declares one (see render.yml) - adding one in the caller
    # too makes the run wait on itself and GitHub cancels it with
    # "deadlock was detected for concurrency group".
    
    jobs:
      site:
        uses: dyerlab/manuscript-theme/.github/workflows/render.yml@v1
        with:
          markdown_files: "manuscript.md supplemental.md index.md"

    Adjust branches: and markdown_files: for that repo. markdown_files is a space-separated list, relative to the repo root.

  2. In the repo's GitHub Settings -> Pages, set "Build and deployment" -> Source to GitHub Actions (one-time, per repo).

  3. (Optional) For any foo.md, add a sibling foo.meta.yml with a YAML title: / author: / lang: block to control that page's <title> and meta tags:

    title: "Your Title Here"
    author:
      - First Author
      - Second Author
    lang: en-US

    Keep this in its own file rather than inline in the .md - see below for why. A .md file with no matching .meta.yml still renders fine; pandoc just falls back to the filename as the page title.

  4. Put figures/images in a media/ folder (or pass a different media_dir: input) and reference them from the markdown as media/whatever.png - the build copies that folder alongside the rendered HTML, and also drops the shared CSS into media/ there, so the relative paths resolve either way.

Updating every manuscript at once

The template/CSS/build logic all live here, in .github/actions/render-site/. Manuscript repos pin a version (@v1, or a specific tag/SHA for full reproducibility). To ship a style change to everything at once: edit here, commit, and move the v1 tag forward (or cut v2 and have people upgrade deliberately). Nothing needs to change in the individual manuscript repos unless the inputs (markdown_files, media_dir) change.

Why the metadata is a separate .meta.yml file, not inline YAML

Pandoc's markdown reader treats any bare --- line preceded by a blank line as a possible YAML-metadata delimiter - not just the one at the very top of the file. A manuscript that uses --- as a plain section divider (common in scientific papers) will, once the file also carries a leading YAML block, have pandoc try to reparse later dividers as more metadata. Depending on pandoc's version this either silently drops the content between two dividers, or hard-fails the build. Keeping title/author/lang in a separate file sidesteps this entirely - the .md never contains a YAML block, so every bare --- (or ***) is unambiguously a horizontal rule. The render action reads the sidecar file via --metadata-file and disables in-document YAML parsing (-f markdown-yaml_metadata_block) as a second layer of protection.

Two other things worth knowing if a manuscript's rendered HTML looks like it's missing content: (1) a ---/*** divider is safe on its own, but if pandoc ever needs to be told about it, prefer *** - it can't be misread as a table or metadata delimiter the way --- can. (2) an ATX heading (# Heading) needs a blank line before it; glued directly to the end of a paragraph, pandoc treats it as a continuation of that paragraph's text instead of a heading.

Repo layout

.github/
  workflows/
    render.yml            <- the reusable workflow manuscript repos call
  actions/
    render-site/
      action.yml           <- composite action: runs pandoc
      templates/
        template.html5      <- pandoc HTML template (no duplicate title
                                block - manuscripts format their own)
      theme/
        theme.css            <- adapted from jez/pandoc-markdown-css-theme
        skylighting-solarized-theme.css

Credits

CSS and template structure adapted from jez/pandoc-markdown-css-theme.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors