@bbc/morty-docs 3.0.1 → 3.0.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.
@@ -28,11 +28,12 @@ const generateTransformInput = dir => {
28
28
  if (fs.existsSync(fullPath)) {
29
29
  // fs.exists() is deprecated, but fs.existsSync() is not.
30
30
  const stats = fs.statSync(fullPath);
31
- console.log('Good symlink');
31
+ console.log('Good symlink', fullPath);
32
32
  if (stats.isFile()) {
33
33
  // get file details
34
34
  list.push(makeInputObject(fullPath, dir)); // symlinks become copies
35
35
  } else {
36
+ console.log('directory... continue');
36
37
  // recursive call to get all files in the symlinked directory
37
38
  const newlist = generateTransformInput(fullPath);
38
39
  list = list.concat(newlist);
@@ -43,12 +44,13 @@ const generateTransformInput = dir => {
43
44
  continue;
44
45
  }
45
46
  }
47
+ console.log(list);
46
48
  return list;
47
49
  };
48
50
  const makeInputObject = (fullPath, rootPath) => {
49
51
  return {
50
52
  relativePath: fullPath.replace(`${rootPath}/`, ''),
51
- raw: fs.readFileSync(fullPath, 'utf-8')
53
+ raw: fs.readFileSync(fullPath)
52
54
  };
53
55
  };
54
56
  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.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": {