Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/core/fetch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export function fetchMixin(proto) {
case 'object':
key = Object.keys(notFoundPage)
.sort((a, b) => b.length - a.length)
.find(k => path.match(new RegExp('^' + k)));
.filter(k => path.match(new RegExp('^' + k)))[0];

path404 = (key && notFoundPage[key]) || defaultPath;
break;
Expand Down
2 changes: 1 addition & 1 deletion src/core/render/compiler/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const linkCompiler = ({

href = router.toURL(href, null, router.getCurrentPath());
} else {
if (!isAbsolutePath(href) && href.startsWith('./')) {
if (!isAbsolutePath(href) && href.slice(0, 2) === './') {
href =
document.URL.replace(/\/(?!.*\/).*/, '/').replace('#/./', '') + href;
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/render/embed.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function walkFetchEmbed({ embedTokens, compile, fetch }, cb) {
// Resolves relative links to absolute
text = text.replace(/\[([^[\]]+)\]\(([^)]+)\)/g, x => {
const linkBeginIndex = x.indexOf('(');
if (x.substring(linkBeginIndex).startsWith('(.')) {
if (x.slice(linkBeginIndex, linkBeginIndex + 2) === '(.') {
return (
x.substring(0, linkBeginIndex) +
`(${window.location.protocol}//${window.location.host}${path}/` +
Expand Down
6 changes: 4 additions & 2 deletions src/core/render/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,10 @@ export function renderMixin(proto) {

if (hideSidebar) {
// FIXME : better styling solution
document.querySelector('aside.sidebar').remove();
document.querySelector('button.sidebar-toggle').remove();
[
document.querySelector('aside.sidebar'),
document.querySelector('button.sidebar-toggle'),
].forEach(node => node.parentNode.removeChild(node));
document.querySelector('section.content').style.right = 'unset';
document.querySelector('section.content').style.left = 'unset';
document.querySelector('section.content').style.position = 'relative';
Expand Down
5 changes: 3 additions & 2 deletions src/plugins/search/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,9 @@ export function init(config, vm) {

if (Array.isArray(config.pathNamespaces)) {
namespaceSuffix =
config.pathNamespaces.find(prefix => path.startsWith(prefix)) ||
namespaceSuffix;
config.pathNamespaces.filter(
prefix => path.slice(0, prefix.length) === prefix
)[0] || namespaceSuffix;
} else if (config.pathNamespaces instanceof RegExp) {
const matches = path.match(config.pathNamespaces);

Expand Down