Giter Club home page Giter Club logo

pandoc-pages's Introduction

Pandoc Conversion and Pages Deployment Action

Note

This action is for my personal use and hasn't been thoroughly tested.

This GitHub Action creates and deploys a single-page GitHub Pages website from the gh-pages branch. It converts content from a Markdown file to HTML using Pandoc whenever changes are made. It also deploys the website if any other relevant files are modified.

Repository Structure

Here's what your repo structure's main branch should look like:

- your-repo/
  ├── .github/
  │   └── workflows/
  │       └── convert-and-deploy.yml     # Workflow to call this action
  ├── assets/
  │   ├── index.md                       # Markdown file to be converted
  │   └── template.html                  # HTML template for conversion
  ├── public/                            # Files to deploy
  │   └── index.html                     # Converted HTML file
  │   └── ...                            # Other public/ files and directories
  └── ...                                # Other project files and directories

Setup

  1. Go to Settings > Actions > General > Workflow permissions and enable Read and write permissions.

  2. Ensure that the required files are in the main branch's root directory:

mkdir -p assets public && touch assets/index.md assets/template.html public/index.html
  1. Create the workflow:
mkdir -p .github/workflows && touch .github/workflows/convert-and-deploy.yml

Paste the following into convert-and-deploy.yml:

name: "Convert & Deploy"
on:
  push:
    paths:
      - "assets/index.md"
      - "assets/template.html"
      - "public/**"
  workflow_dispatch:
jobs:
  convert:
    runs-on: ubuntu-latest
    steps:
      - name: "Run Pandoc Conversion and Pages Deployment action"
        uses: srciaga/pandoc-pages@main
        with:
          gh_token: ${{ secrets.GITHUB_TOKEN }}
  1. Push all the file's you've added so far.
  2. The workflow should run and create the gh-pages branch. If not, go to the Actions tab, click on the Convert & Deploy workflow. Run the workflow from the main branch.
  3. Go to Settings > Pages > Build and deployment and configure the following:
    • Source: Deploy from a branch
    • Branch: gh-pages / (root)
  4. git pull and push modifications to index.md and template.html. Your website will automatically deploy! Remember to pull after each deployment.

There are sample files for index.md and template.html in this repo.

Check out the Pandoc User's Guide to learn more about templates and Pandoc's extended markdown.

pandoc-pages's People

Contributors

srciaga avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.