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

Commit

Permalink
Add: verify Docsify links work in Github
Browse files Browse the repository at this point in the history
Docsify links can reference the path of a page, without the '.md'
suffix. This breaks links when page markdown is viewed elsewhere, such
as in Github.

This fix verifies all Docsify links refer to the full markdown filename.
  • Loading branch information
rg-wood committed Sep 23, 2022
1 parent feed8ff commit 029fe2c
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 13 deletions.
27 changes: 27 additions & 0 deletions .markdownlint/rules/docsify-markdown-suffix.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const common = require('./common.js')

module.exports = {
"names": [ "docsify-markdown-suffix" ],
"description": "Docsify links should reference full file name",
"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 (common.isDocsifyLink(attr) && !attr[1].startsWith('#') && !attr[1].includes('.md')) {
onError({
"lineNumber": inline.lineNumber,
"context": attr[1]
});
}
}
})
});
}
};
2 changes: 1 addition & 1 deletion contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Guide
### 2. Terminology

1. Key terms should be in bold and capitalised for emphasis, e.g. **Proficiency**.
2. Key terms should be linked, e.g. [Proficiency](./pages/rules/proficiency).
2. Key terms should be linked, e.g. [Proficiency](./pages/rules/proficiency.md).
3. Exceptions to linking include:
1. Where a term has been defined nearby in the text.
4. Avoid using too many key terms in a text block to prevent visual overload.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"predeploy": "npm run test && npm run clean && npm run build",
"deploy": "gh-pages -d dist -b gh-pages -t",
"deploy:itch": "butler push dist/ grislyeye/three-meet:HTML",
"test": "htmlhint 'index.html' && npx markdownlint '**/*.md' --ignore dist --ignore node_modules --rules .markdownlint/rules/docsify-relative-links.js --rules .markdownlint/rules/docsify-links-fragments-only.js && stylelint 'themes/cold-tavern/**/*.css'"
"test": "htmlhint 'index.html' && npx markdownlint '**/*.md' --ignore dist --ignore node_modules --rules .markdownlint/rules/docsify-relative-links.js --rules .markdownlint/rules/docsify-links-fragments-only.js --rules .markdownlint/rules/docsify-markdown-suffix.js && stylelint 'themes/cold-tavern/**/*.css'"
},
"dependencies": {
"@fortawesome/fontawesome-free": "^6.2.0",
Expand Down
2 changes: 1 addition & 1 deletion pages/backgrounds/knave.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ You're basically a thug, running enforcement, protection rackets, or acting as b

1st-level Ruffian speciality feature

While you are not wearing any armour, your [Defence](../../pages/combat/attacks#defence) equals **10 + [Cunning](../../pages/characters/attributes#cunning) + [Might](../../pages/characters/attributes#might)**.
While you are not wearing any armour, your [Defence](../../pages/combat/attacks.md#defence) equals **10 + [Cunning](../../pages/characters/attributes.md#cunning) + [Might](../../pages/characters/attributes.md#might)**.
2 changes: 1 addition & 1 deletion pages/backgrounds/noble.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ You start with the following items:

1st-level Noble background feature

You must have an [Allegiances](../../pages/characters/allegiances) for your House. Work with your GM to come up with its name and purview (military, land, influence, etc.).
You must have an [Allegiances](../../pages/characters/allegiances.md) for your House. Work with your GM to come up with its name and purview (military, land, influence, etc.).

## Privilege

Expand Down
4 changes: 2 additions & 2 deletions pages/classes/wise.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ When you transform you can choose one of the following for your new form:

2nd-level Elementalist spell

You summon elemental forces from deep in the earth at a [Nearby](../../pages/rules/distance.md) location. Stone crumbles. Soil turns into mire. The area [Close](../../pages/rules/distance.md) to this location is considered [Difficult Terrain](../../pages/rules/distance.md#difficult-terrain). A creature in the area when you cast the spell must succeed on a [Might](../../pages/characters/attributes#might) [Save](../../pages/rules/rolling/saves.md) or they cannot make a [Move](../../pages/combat/moves.md) and are [Disadvantaged](../../pages/rules/conditions.md#disadvantaged). They can use an [Action](../../pages/combat/actions.md) to make a [Might](../../pages/characters/attributes#might) [Save](../../pages/rules/rolling/saves.md) to free themselves.
You summon elemental forces from deep in the earth at a [Nearby](../../pages/rules/distance.md) location. Stone crumbles. Soil turns into mire. The area [Close](../../pages/rules/distance.md) to this location is considered [Difficult Terrain](../../pages/rules/distance.md#difficult-terrain). A creature in the area when you cast the spell must succeed on a [Might](../../pages/characters/attributes.md#might) [Save](../../pages/rules/rolling/saves.md) or they cannot make a [Move](../../pages/combat/moves.md) and are [Disadvantaged](../../pages/rules/conditions.md#disadvantaged). They can use an [Action](../../pages/combat/actions.md) to make a [Might](../../pages/characters/attributes.md#might) [Save](../../pages/rules/rolling/saves.md) to free themselves.

</section>

Expand Down Expand Up @@ -212,7 +212,7 @@ You can cast spells. To cast a spell you must expend a **Wise Slot**. Each spell

1st-level Sorcerer spell

You pull back the veil, revealing a glimpse of what lies beyond the mortal realm. Each creature **Close** to you must make a [Wisdom](../../pages/characters/attributes.md#wisdom) [Save](../../pages/rules/rolling/saves.md) against your **Spell Difficulty**. Creatures that fail their saves are [Frightened](../../pages/rules/conditions#frightened) by you until the end of your next turn.
You pull back the veil, revealing a glimpse of what lies beyond the mortal realm. Each creature **Close** to you must make a [Wisdom](../../pages/characters/attributes.md#wisdom) [Save](../../pages/rules/rolling/saves.md) against your **Spell Difficulty**. Creatures that fail their saves are [Frightened](../../pages/rules/conditions.md#frightened) by you until the end of your next turn.

</section>

Expand Down
2 changes: 1 addition & 1 deletion pages/combat/attacks.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ You can make one **Attack** per turn. When you make an **Attack**:
2. Make a [Check](../../pages/rules/rolling/checks.md)
3. Add your [Proficiency](../../pages/rules/proficiency.md) if you are proficient with the **Attack**
4. The difficulty is the opponent's **Defence**
5. If you hit, roll for damage and take that from the target's [Stamina](../../pages/combat/stamina)
5. If you hit, roll for damage and take that from the target's [Stamina](../../pages/combat/stamina.md)

## Describing Attacks

Expand Down
8 changes: 4 additions & 4 deletions pages/equipment/armour.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

Rule

**Armour** increases your [Defence](../../pages/combat/attacks/md#defence).
**Armour** increases your [Defence](../../pages/combat/attacks.md#defence).

## Describing Armour

Rule

**Armour** is described by it's **Base [Defence](../../pages/combat/attacks/md#defence)** and by a number of **Tags** listed in parentheses after its name. For example, **Leather Armour (Defence 13, Light)** is a a set of armour that gives you a [Defence](../../pages/combat/attacks/md#defence) of **13 + your Cunning**.
**Armour** is described by it's **Base [Defence](../../pages/combat/attacks.md#defence)** and by a number of **Tags** listed in parentheses after its name. For example, **Leather Armour (Defence 13, Light)** is a a set of armour that gives you a [Defence](../../pages/combat/attacks.md#defence) of **13 + your Cunning**.

| Tag | Description |
| --------- | - |
| Heavy | [Disadvantage](../../pages/rules/advantage.md) on [Stealth](../../pages/characters/skills.md#stealth) [Checks](../../pages/rules/rolling/checks.md)
| Light | Add you [Cunning](../../pages/characters/attributes.md#cunning) to your [Defence](../../pages/combat/attacks/md#defence)
| Medium | Add you [Cunning](../../pages/characters/attributes.md#cunning) to your [Defence](../../pages/combat/attacks/md#defence) to a maximum of **+2** *and* [Disadvantage](../../pages/rules/advantage.md) on [Stealth](../../pages/characters/skills.md#stealth) [Checks](../../pages/rules/rolling/checks.md)
| Light | Add you [Cunning](../../pages/characters/attributes.md#cunning) to your [Defence](../../pages/combat/attacks.md#defence)
| Medium | Add you [Cunning](../../pages/characters/attributes.md#cunning) to your [Defence](../../pages/combat/attacks.md#defence) to a maximum of **+2** *and* [Disadvantage](../../pages/rules/advantage.md) on [Stealth](../../pages/characters/skills.md#stealth) [Checks](../../pages/rules/rolling/checks.md)
2 changes: 1 addition & 1 deletion pages/rules/conditions.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Rule

Condition

Many effects can exhaust, hinder, confuse, or distract you, making you **Disadvantaged**. When **Disadvantaged** you roll with [Disadvantage](../../pages/rules/advantage) on all [Checks, Saves, and Attacks](../../pages/rules/rolling/checks.md).
Many effects can exhaust, hinder, confuse, or distract you, making you **Disadvantaged**. When **Disadvantaged** you roll with [Disadvantage](../../pages/rules/advantage.md) on all [Checks, Saves, and Attacks](../../pages/rules/rolling/checks.md).

</section>

Expand Down
2 changes: 1 addition & 1 deletion pages/rules/rests.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ A rest is a 8 hours of extended downtime during which a character sleeps or perf
A rest confers the following benefits:

* Regain all [Stamina](../../pages/combat/stamina.md)
* Regain expended [Class](../../pages/classes/index) and [Background](../../pages/backgrounds/index) features
* Regain expended [Class](../../pages/classes/index.md) and [Background](../../pages/backgrounds/index.md) features

0 comments on commit 029fe2c

Please sign in to comment.