@bbc/morty-docs 1.12.1 → 1.12.2
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,6 +7,13 @@ 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
|
+
}; // Replace hash links with .html e.g. page.md#Title becomes page.html#Title.
|
|
11
|
+
|
|
12
|
+
const convertMdHashLinksToHtmlLinks = {
|
|
13
|
+
type: 'output',
|
|
14
|
+
regex: /<a href="([^:\n]*?).md#(.*?)">/g,
|
|
15
|
+
// exclude colon, so external links aren't converted
|
|
16
|
+
replace: '<a href="$1.html#$2">'
|
|
10
17
|
};
|
|
11
18
|
const headingExtension = {
|
|
12
19
|
type: 'output',
|
|
@@ -42,7 +49,7 @@ const createParser = options => {
|
|
|
42
49
|
replace: `<a href="${basePath}/$1">`
|
|
43
50
|
};
|
|
44
51
|
const parser = new showdown.Converter({
|
|
45
|
-
extensions: [convertMdLinksToHtmlLinks, addBasePathToRootLinks, headingExtension, ...bindings]
|
|
52
|
+
extensions: [convertMdLinksToHtmlLinks, convertMdHashLinksToHtmlLinks, addBasePathToRootLinks, headingExtension, ...bindings]
|
|
46
53
|
});
|
|
47
54
|
parser.setFlavor('github');
|
|
48
55
|
return parser;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bbc/morty-docs",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.2",
|
|
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": {
|