@bbc/morty-docs 1.11.3 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -7,7 +7,10 @@ const convertMdLinksToHtmlLinks = {
|
|
|
7
7
|
regex: /<a href="([^:\n]*).md">/g,
|
|
8
8
|
// exclude colon, so external links aren't converted
|
|
9
9
|
replace: '<a href="$1.html">'
|
|
10
|
-
};
|
|
10
|
+
}; // Due to the converter the global replace on links is broken so if you have multiple links per line we need multiple matchers or they don't get replaced.
|
|
11
|
+
|
|
12
|
+
const maxLinksPerLine = 10;
|
|
13
|
+
const convertMultipleMdLinksToHtmlLinks = new Array(maxLinksPerLine).fill().map(x => convertMdLinksToHtmlLinks);
|
|
11
14
|
const headingExtension = {
|
|
12
15
|
type: 'output',
|
|
13
16
|
regex: /<(h[123456]) id="(.*)">(.*)<\/\1>/g,
|
|
@@ -42,7 +45,7 @@ const createParser = options => {
|
|
|
42
45
|
replace: `<a href="${basePath}/$1">`
|
|
43
46
|
};
|
|
44
47
|
const parser = new showdown.Converter({
|
|
45
|
-
extensions: [
|
|
48
|
+
extensions: [convertMultipleMdLinksToHtmlLinks, addBasePathToRootLinks, headingExtension, ...bindings]
|
|
46
49
|
});
|
|
47
50
|
parser.setFlavor('github');
|
|
48
51
|
return parser;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bbc/morty-docs",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"description": "To generate a static website from markdown documentation, to allow users to consume content in an easily accessible format",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -12,9 +12,10 @@
|
|
|
12
12
|
"start": "rm -rf www && npm run build -- --source-maps && node run.js && npx http-server www",
|
|
13
13
|
"build": "rm -rf build && mkdir build && babel src --out-dir build",
|
|
14
14
|
"build-watch": "npm run build -- --source-maps --watch",
|
|
15
|
-
"test": "jest --runInBand --outputFile test-results.json --json
|
|
15
|
+
"test": "jest --runInBand --outputFile test-results.json --json",
|
|
16
16
|
"coverage": "jest --coverage --runInBand && open coverage/lcov-report/index.html",
|
|
17
17
|
"lint": "standard",
|
|
18
|
+
"posttest": "npm run lint",
|
|
18
19
|
"prepare": "npm run build",
|
|
19
20
|
"postversion": "git push origin main && git push --tags origin main"
|
|
20
21
|
},
|