Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Commit

Permalink
Add: linting
Browse files Browse the repository at this point in the history
Added markdown, CSS and HTML linting. This included Docsify-specific
markdown checking for links that won't work in Github.

Additional changes required:

 * Github Actions deployment
 * Removed HTML from Markdown for simplicity
 * Added sub-headings to all headings

#123

Closes: 

#103
  • Loading branch information
rg-wood authored Sep 23, 2022
1 parent 2eaa063 commit 4dc6b37
Show file tree
Hide file tree
Showing 59 changed files with 3,962 additions and 1,202 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: publish

permissions:
contents: write

on:
push:
tags:
- v*

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3

- name: Install and Build 🔧
run: |
npm ci
npm run build
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.3.3
with:
branch: gh-pages
folder: dist

- name: Clear Cache 🧹
uses: jakejarvis/cloudflare-purge-action@master
env:
CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE }}
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }}
25 changes: 25 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: test-and-lint

on:
push:
pull_request:

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [17.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build
- run: npm test
71 changes: 71 additions & 0 deletions .htmllintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"plugins": [],
"maxerr": false,
"raw-ignore-regex": false,
"attr-bans": [
"align",
"background",
"bgcolor",
"border",
"frameborder",
"longdesc",
"marginwidth",
"marginheight",
"scrolling",
"style",
"width"
],
"indent-delta": false,
"indent-style": "nonmixed",
"indent-width": 2,
"indent-width-cont": false,
"spec-char-escape": true,
"text-ignore-regex": false,
"tag-bans": [
"style",
"b",
"i"
],
"tag-close": true,
"tag-name-lowercase": true,
"tag-name-match": true,
"tag-self-close": false,
"doctype-first": false,
"doctype-html5": false,
"attr-name-style": "dash",
"attr-name-ignore-regex": false,
"attr-no-dup": true,
"attr-no-unsafe-char": true,
"attr-order": false,
"attr-quote-style": false,
"attr-req-value": true,
"attr-new-line": false,
"attr-validate": true,
"id-no-dup": true,
"id-class-no-ad": true,
"id-class-style": "dash",
"class-no-dup": true,
"class-style": false,
"id-class-ignore-regex": false,
"img-req-alt": true,
"img-req-src": true,
"html-valid-content-model": true,
"head-valid-content-model": true,
"href-style": false,
"label-req-for": true,
"line-end-style": false,
"line-no-trailing-whitespace": false,
"line-max-len": false,
"line-max-len-ignore-regex": false,
"head-req-title": true,
"title-no-dup": true,
"title-max-len": 60,
"html-req-lang": false,
"lang-style": "case",
"fig-req-figcaption": false,
"focusable-tabindex-style": false,
"input-radio-req-name": true,
"input-req-label": false,
"table-req-caption": false,
"table-req-header": false
}
40 changes: 40 additions & 0 deletions .markdownlint.docsify-links-fragments-only.rule.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
module.exports = {
"names": [ "docsify-links-fragments-only" ],
"description": "Internal Docsify should use URL fragments (and not '?id=')",
"tags": [ "custom", "docsify" ],
"function": (params, onError) => {
params
.tokens
.filter((token) => token.type === "inline")
.forEach((inline) => {
inline
.children
.filter((child) => child.type === 'link_open')
.forEach((link) => {
for (const attr of link.attrs) {
if (isDocsifyLink(attr) && isRelativeLink(attr) && attr[1].includes('?id=')) {
onError({
"lineNumber": inline.lineNumber,
"context": attr[1]
});
}
}
})
});
}
};

const isDocsifyLink = (link) => {
const href = link[1]
return link[0] === "href"
&& href
&& !href.startsWith('http')
}


const isRelativeLink = (link) => {
const href = link[1]
return link[0] === "href"
&& href
&& (href.startsWith('.') || href.startsWith('#'))
}
40 changes: 40 additions & 0 deletions .markdownlint.docsify-relative-links.rule.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
module.exports = {
"names": [ "docsify-relative-link" ],
"description": "Internal Docsify links should be relative",
"tags": [ "custom", "docsify" ],
"function": (params, onError) => {
params
.tokens
.filter((token) => token.type === "inline")
.forEach((inline) => {
inline
.children
.filter((child) => child.type === 'link_open')
.forEach((link) => {
for (const attr of link.attrs) {
if (isDocsifyLink(attr) && !isRelativeLink(attr)) {
onError({
"lineNumber": inline.lineNumber,
"context": attr[1]
});
}
}
})
});
}
};

const isDocsifyLink = (link) => {
const href = link[1]
return link[0] === "href"
&& href
&& !href.startsWith('http')
}


const isRelativeLink = (link) => {
const href = link[1]
return link[0] === "href"
&& href
&& (href.startsWith('.') || href.startsWith('#'))
}
7 changes: 7 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"default": true,
"no-inline-html": false,
"commands-show-output": false,
"ul-indent": false,
"line-length": false
}
3 changes: 3 additions & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "stylelint-config-standard"
}
36 changes: 20 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
<header>

# Three Meet

<p class="subheading">A low-fantasy 5E hack for dark times</p>

</header>
A low-fantasy 5E hack for dark times

To start playing:

<section class="summaries">

<section class="summary">

### 1. Prepare
## Prepare

Step 1

+ Find somewhere to play
+ Pick a player to be game moderator (GM)
Expand All @@ -23,28 +21,34 @@ To start playing:

<section class="summary">

### 2. Create a character
## Create a character

+ Assign one of +2, +1 and -1 to each of your [Attributes](pages/characters/attributes.md)
+ Choose a [Background](pages/backgrounds/index.md)
+ You may choose a [Magic Speciality](pages/backgrounds/magic.md) if your GM allows
+ Choose a [Class](pages/classes/index.md)
+ Choose your [Allegiances](pages/characters/allegiances.md)
Step 2

+ Assign one of +2, +1 and -1 to each of your [Attributes](./pages/characters/attributes.md)
+ Choose a [Background](./pages/backgrounds/index.md)
+ You may choose a [Magic Speciality](./pages/backgrounds/magic.md) if your GM allows
+ Choose a [Class](./pages/classes/index.md)
+ Choose your [Allegiances](./pages/characters/allegiances.md)

</section>

<section class="summary">

### 3. Learn the rules
## Learn the rules

Step 3

+ Read the [Basic Rules](pages/rules/rolling.md)
+ Read the [Combat Rules](pages/combat/order.md)
+ Read the [Basic Rules](./pages/rules/rolling.md)
+ Read the [Combat Rules](./pages/combat/order.md)

</section>

<section class="summary">

### 4. Play
## Play

Step 4

+ Make an adventure
+ Jump into the action
Expand Down
80 changes: 41 additions & 39 deletions _sidebar.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,44 @@
# Contents

+ Characters
+ [Attributes](pages/characters/attributes.md)
+ [Skills](pages/characters/skills.md)
+ [Allegiances](pages/characters/allegiances.md)
+ [Backgrounds](pages/backgrounds/index.md)
+ [Guild Artisan](pages/backgrounds/guild-artisan.md)
+ [Knave](pages/backgrounds/knave.md)
+ [Noble](pages/backgrounds/noble.md)
+ [Magic Specialities](pages/backgrounds/magic.md)
+ [Classes](pages/classes/index.md)
+ [The Mighty](pages/classes/mighty.md)
+ [The Cunning](pages/classes/cunning.md)
+ [The Wise](pages/classes/wise.md)
+ [Attributes](./pages/characters/attributes.md)
+ [Skills](./pages/characters/skills.md)
+ [Allegiances](./pages/characters/allegiances.md)
+ [Backgrounds](./pages/backgrounds/index.md)
+ [Guild Artisan](./pages/backgrounds/guild-artisan.md)
+ [Knave](./pages/backgrounds/knave.md)
+ [Noble](./pages/backgrounds/noble.md)
+ [Magic Specialities](./pages/backgrounds/magic.md)
+ [Classes](./pages/classes/index.md)
+ [The Mighty](./pages/classes/mighty.md)
+ [The Cunning](./pages/classes/cunning.md)
+ [The Wise](./pages/classes/wise.md)
+ Basic Rules
+ [Rolling](pages/rules/rolling.md)
+ [Checks](pages/rules/rolling/checks.md)
+ [Group Checks](pages/rules/rolling/group.md)
+ [Contests](pages/rules/rolling/contests.md)
+ [Saves](pages/rules/rolling/saves.md)
+ [Advantage/Disadvantage](pages/rules/advantage.md)
+ [Proficiency](pages/rules/proficiency.md)
+ [Usage Die](pages/rules/usage.md)
+ [Distance](pages/rules/distance.md)
+ [Rests](pages/rules/rests.md)
+ [Conditions](pages/rules/conditions.md)
+ [Combat](pages/combat/index.md)
+ [Actions](pages/combat/actions.md)
+ [Attacks](pages/combat/attacks.md)
+ [Moves](pages/combat/moves.md)
+ [Bonus Actions](pages/combat/bonus-actions.md)
+ [Reactions](pages/combat/reactions.md)
+ [Stamina](pages/combat/stamina.md)
* Equipment
* [Wealth](pages/equipment/wealth.md)
* [Armour](pages/equipment/armour.md)
* [Packs](pages/equipment/packs.md)
* [Retainers](pages/equipment/retainers.md)
+ [Rolling](./pages/rules/rolling.md)
+ [Checks](./pages/rules/rolling/checks.md)
+ [Group Checks](./pages/rules/rolling/group.md)
+ [Contests](./pages/rules/rolling/contests.md)
+ [Saves](./pages/rules/rolling/saves.md)
+ [Advantage/Disadvantage](./pages/rules/advantage.md)
+ [Proficiency](./pages/rules/proficiency.md)
+ [Usage Die](./pages/rules/usage.md)
+ [Distance](./pages/rules/distance.md)
+ [Rests](./pages/rules/rests.md)
+ [Conditions](./pages/rules/conditions.md)
+ [Combat](./pages/combat/index.md)
+ [Actions](./pages/combat/actions.md)
+ [Attacks](./pages/combat/attacks.md)
+ [Moves](./pages/combat/moves.md)
+ [Bonus Actions](./pages/combat/bonus-actions.md)
+ [Reactions](./pages/combat/reactions.md)
+ [Stamina](./pages/combat/stamina.md)
+ Equipment
+ [Wealth](./pages/equipment/wealth.md)
+ [Armour](./pages/equipment/armour.md)
+ [Packs](./pages/equipment/packs.md)
+ [Retainers](./pages/equipment/retainers.md)
+ Colophon
+ [Design Notes](design-notes.md)
+ [Contributing](contributing.md)
+ [License](license.md)
+ [Credits](credits.md)
+ [Design Notes](./design-notes.md)
+ [Contributing](./contributing.md)
+ [License](./license.md)
+ [Credits](./credits.md)
Loading

0 comments on commit 4dc6b37

Please sign in to comment.