@bbc/morty-docs 3.0.1 → 3.0.3

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.
@@ -48,7 +48,7 @@ const generateTransformInput = dir => {
48
48
  const makeInputObject = (fullPath, rootPath) => {
49
49
  return {
50
50
  relativePath: fullPath.replace(`${rootPath}/`, ''),
51
- raw: fs.readFileSync(fullPath, 'utf-8')
51
+ raw: fs.readFileSync(fullPath)
52
52
  };
53
53
  };
54
54
  module.exports = generateTransformInput;
@@ -45,8 +45,14 @@ const createParser = options => {
45
45
  // exclude colon, so external links aren't converted
46
46
  replace: `<a href="${basePath}/$1">`
47
47
  };
48
+ const addBasePathToLinkHrefs = {
49
+ type: 'output',
50
+ regex: /<link(.+)href="\/([^:\n]*)"(.*)\/>/g,
51
+ // exclude colon, so external links aren't converted
52
+ replace: `<link$1href="${basePath}/$2"$3/>`
53
+ };
48
54
  const parser = new showdown.Converter({
49
- extensions: [convertMdLinksToHtmlLinks, convertMdHashLinksToHtmlLinks, addBasePathToRootLinks, headingExtension, ...bindings]
55
+ extensions: [convertMdLinksToHtmlLinks, convertMdHashLinksToHtmlLinks, addBasePathToRootLinks, addBasePathToLinkHrefs, headingExtension, ...bindings]
50
56
  });
51
57
  parser.setFlavor('github');
52
58
  return parser;
@@ -134,12 +134,12 @@ const contentStyles = `
134
134
  border-radius: 0;
135
135
  }
136
136
 
137
- .content p code {
137
+ .content :not(pre) code {
138
138
  padding: 2px 4px;
139
- font-size: 90%;
140
- color: #c7254e;
141
- background-color: #f9f2f4;
142
- border-radius: 4px;
139
+ font-size: 90%;
140
+ color: #c7254e;
141
+ background-color: #f9f2f4;
142
+ border-radius: 4px;
143
143
  }
144
144
 
145
145
  .content table {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbc/morty-docs",
3
- "version": "3.0.1",
3
+ "version": "3.0.3",
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": {