-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from bvobart/mllint-site
Adds source code for mllint's GitHub Pages website
- Loading branch information
Showing
26 changed files
with
1,471 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: Publish mllint's GitHub Pages website | ||
|
||
# Runs on | ||
# - pushes to master with changes to the files in docs/gh-pages or this file | ||
# - release tags | ||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- docs/gh-pages | ||
- .github/workflows/gh-pages.yml | ||
tags: | ||
- "v*" | ||
|
||
jobs: | ||
publish: | ||
name: Build and publish mllint's website to GitHub Pages | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: ^1.16 | ||
|
||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: true # Fetch Hugo theme (true OR recursive) | ||
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod | ||
|
||
- uses: actions/cache@v2 | ||
with: | ||
# In order: | ||
# * Go module download cache | ||
# * Go build cache (Linux) | ||
path: | | ||
~/go/pkg/mod | ||
~/.cache/go-build | ||
key: ubuntu-latest-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
ubuntu-latest-go- | ||
- name: Setup Hugo | ||
uses: peaceiris/actions-hugo@v2 | ||
with: | ||
hugo-version: '0.85.0' | ||
extended: true | ||
|
||
- name: Generate Categories & Rules documentation | ||
run: go run ./docs/gh-pages/scripts/generate-docs.go | ||
|
||
- name: Build website (tagged version) | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
working-directory: docs/gh-pages/ | ||
env: | ||
HUGO_MLLINT_VERSION: ${GITHUB_REF#refs/tags/v} | ||
run: | | ||
echo "> mllint version: $HUGO_MLLINT_VERSION" | ||
hugo --minify | ||
- name: Build website (regular commit) | ||
if: startsWith(github.ref, 'refs/heads/') | ||
working-directory: docs/gh-pages/ | ||
run: | | ||
export HUGO_MLLINT_VERSION=$(git describe --tags) | ||
echo "> mllint version: $HUGO_MLLINT_VERSION" | ||
hugo --minify | ||
- name: Deploy website | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./docs/gh-pages/public/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "docs/gh-pages/themes/PaperMod"] | ||
path = docs/gh-pages/themes/PaperMod | ||
url = https://github.com/adityatelange/hugo-PaperMod.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/content/docs/categories/* | ||
!/content/docs/categories/_index.md | ||
|
||
/content/docs/rules/* | ||
!/content/docs/rules/_index.md | ||
|
||
/public/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# [`mllint`'s GitHub Pages website](https://bvobart.github.io/mllint/) | ||
|
||
This directory contains the source code for `mllint`'s GitHub Pages website. It's a static website generated from Markdown files using [Hugo](https://gohugo.io/) and uses the [PaperMod](https://git.io/hugopapermod) theme with some custom tweaks and accent colours by me, Bart van Oort (@bvobart). | ||
|
||
## Folder structure | ||
|
||
```sh | ||
. | ||
├── assets # contains custom CSS and HighlightJS theme | ||
├── content # contains all of the Markdown files that make up the content of the website. Part of it needs to be generated. | ||
├── layouts # contains overridden layout files from the theme for some layout tweaks. | ||
├── public # when the website is built, this is where it ends up | ||
├── scripts # contains the scripts to generate the category and rule documentation files | ||
├── static # contains static files, e.g. images. | ||
├── themes # contains a submodule with the PaperMod theme | ||
├── config.yml # Hugo's configuration file. | ||
└── ReadMe.md | ||
``` | ||
|
||
## Building & Developing | ||
|
||
There's a GitHub Actions workflow (see `.github/workflows/gh-pages.yml` in this repo) that automatically builds and publishes this website on every push to `main` containing changes to this folder and on every pushed tag. The built website can be viewed on the `gh-pages` branch of this repo. | ||
|
||
For developing this website, you'll want to be able to run it locally. To do so, make sure you have Go and [Hugo](https://gohugo.io/) installed. Then, from this folder (`docs/gh-pages`), run the following commands: | ||
|
||
```sh | ||
git submodule update --init # to download the theme | ||
./scripts/clean-docs.sh && go run ./scripts/generate-docs.go # to generate the rules & categories documentation | ||
hugo server # runs a development server, see http://localhost:1313/mllint/ when it's running | ||
``` | ||
|
||
> Note: you can re-generate the rules & categories documentation _while_ the Hugo server is running and Hugo will pick up the changes automatically. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
.footer-version { | ||
font-size: 12px; | ||
color: var(--secondary); | ||
max-width: calc(var(--main-width) + var(--gap) * 2); | ||
margin: auto; | ||
padding-bottom: 8px; | ||
text-align: center; | ||
} | ||
|
||
.footer { | ||
padding-bottom: 4px; | ||
} | ||
|
||
.footer-version span { | ||
margin-inline-start: 1px; | ||
margin-inline-end: 1px; | ||
} | ||
|
||
.footer-version span:last-child { | ||
white-space: nowrap; | ||
} | ||
|
||
.footer-version a { | ||
color: inherit; | ||
border-bottom: 1px solid var(--secondary); | ||
} | ||
|
||
.footer-version a:hover { | ||
color: var(--primary); | ||
border-bottom: 1px solid var(--primary); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
/* | ||
* Visual Studio 2015 dark style | ||
* Author: Nicolas LLOBERA <[email protected]> | ||
* Sourced from: https://github.com/highlightjs/highlight.js/blob/main/src/styles/vs2015.css | ||
*/ | ||
|
||
.hljs { | ||
background: #1E1E1E; | ||
color: #DCDCDC; | ||
} | ||
|
||
.hljs-keyword, | ||
.hljs-literal, | ||
.hljs-symbol, | ||
.hljs-name { | ||
color: #569CD6; | ||
} | ||
.hljs-link { | ||
color: #569CD6; | ||
text-decoration: underline; | ||
} | ||
|
||
.hljs-built_in, | ||
.hljs-type { | ||
color: #4EC9B0; | ||
} | ||
|
||
.hljs-number, | ||
.hljs-class { | ||
color: #B8D7A3; | ||
} | ||
|
||
.hljs-string, | ||
.hljs-meta .hljs-string { | ||
color: #D69D85; | ||
} | ||
|
||
.hljs-regexp, | ||
.hljs-template-tag { | ||
color: #9A5334; | ||
} | ||
|
||
.hljs-subst, | ||
.hljs-function, | ||
.hljs-title, | ||
.hljs-params, | ||
.hljs-formula { | ||
color: #DCDCDC; | ||
} | ||
|
||
.hljs-comment, | ||
.hljs-quote { | ||
color: #57A64A; | ||
font-style: italic; | ||
} | ||
|
||
.hljs-doctag { | ||
color: #608B4E; | ||
} | ||
|
||
.hljs-meta, | ||
.hljs-meta .hljs-keyword, | ||
|
||
.hljs-tag { | ||
color: #9B9B9B; | ||
} | ||
|
||
.hljs-variable, | ||
.hljs-template-variable { | ||
color: #BD63C5; | ||
} | ||
|
||
.hljs-attr, | ||
.hljs-attribute { | ||
color: #9CDCFE; | ||
} | ||
|
||
.hljs-section { | ||
color: gold; | ||
} | ||
|
||
.hljs-emphasis { | ||
font-style: italic; | ||
} | ||
|
||
.hljs-strong { | ||
font-weight: bold; | ||
} | ||
|
||
/*.hljs-code { | ||
font-family:'Monospace'; | ||
}*/ | ||
|
||
.hljs-bullet, | ||
.hljs-selector-tag, | ||
.hljs-selector-id, | ||
.hljs-selector-class, | ||
.hljs-selector-attr, | ||
.hljs-selector-pseudo { | ||
color: #D7BA7D; | ||
} | ||
|
||
.hljs-addition { | ||
background-color: #144212; | ||
display: inline-block; | ||
width: 100%; | ||
} | ||
|
||
.hljs-deletion { | ||
background-color: #600; | ||
display: inline-block; | ||
width: 100%; | ||
} |
Oops, something went wrong.