Skip to content

Commit

Permalink
fix(scully): fix rewrite of .md on external sites (#611)
Browse files Browse the repository at this point in the history
This is a quick fix. the plugin still needs to be moved to ts plugins filder

ISSUES CLOSED: #609
  • Loading branch information
SanderElias authored Jun 8, 2020
1 parent 93ace4e commit de9e059
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion demos/plugins/docs-link-update.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// TODO: move into plugins folder as TS file.
const {
registerPlugin,
configValidator,
Expand All @@ -13,7 +14,11 @@ const docsLink = async (html, options) => {
const anchors = [...window.document.querySelectorAll('[href]')];
anchors.forEach(a => {
const href = a.getAttribute('href');
if (href && href.toLowerCase().endsWith('.md')) {
if (
href &&
href.toLowerCase().endsWith('.md') &&
!href.toLowerCase().startsWith('http')
) {
const newRef = `/docs/${href.slice(0, -3)}`;
a.setAttribute('href', newRef);
}
Expand Down

0 comments on commit de9e059

Please sign in to comment.