-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocpad.js
More file actions
28 lines (24 loc) · 799 Bytes
/
Copy pathdocpad.js
File metadata and controls
28 lines (24 loc) · 799 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
var URI = require('URIjs');
var rewriteMdLinks = function (content) {
return content.replace(/(<a\s[^>]*href="[\w-/\.]+)\.md(["#])/gm, "$1.html$2");
};
var githubLocation = function () {
// in case we're on Windows, replace "\" in the path with "/"
var relativePath = this.document.relativePath.replace(/\\/g, "/");
return "https://github.com/fluid-project/infusion-docs/blob/master/" + relativePath;
}
var relativeUrl = function (forUrl) {
return URI(forUrl).relativeTo(this.document.url);
}
module.exports = {
renderSingleExtensions: true,
plugins: {
handlebars: {
helpers: {
rewriteMdLinks: rewriteMdLinks,
githubLocation: githubLocation,
relativeUrl: relativeUrl
}
}
}
}