Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

noCompileLinks doesn't work with ../ #230

Closed
nitzantomer opened this issue Aug 8, 2017 · 4 comments
Closed

noCompileLinks doesn't work with ../ #230

nitzantomer opened this issue Aug 8, 2017 · 4 comments
Labels

Comments

@nitzantomer
Copy link

nitzantomer commented Aug 8, 2017

I have nested directories in my docsify based site, that is the structure is something like this:

  • root
    • index.html
    • _sidebar.md
    • README.md
    • sub1
      • index.html
      • _sidebar.md
      • README.md
      • sub1.2
        • index.html
        • _sidebar.md
        • README.md
    • sub2
      • index.html
      • _sidebar.md
      • README.md

Everything works perfectly, except that in sub-directories, in the _sidebar.md files I try to link to documents in parent directories, like so:

- [Getting started](../)
...

But the links are compiled into: #/..
I tried using the noCompileLinks feature:

window.$docsify = {
    noCompileLinks: [
        "../*"
    ]
}

But it has no effect.

Any idea how to solve this?
Thanks.

@QingWei-Li
Copy link
Member

You need to use regular expression: ../.* It will be executed by new RegExp('../.*')

@nitzantomer
Copy link
Author

Oh, makes sense.

Also, now that it works I notice that it opens it in a new tab, is there a way to keep it in the same window?
I know that I can control it with external-link-target, but I do have some external links which I'd like to open in a new tab, but in this case, I just don't consider it as an "external link".

Thanks.

@QingWei-Li
Copy link
Member

Now you can set the link attribute separately

[link](/demo ":target=_blank")
[link](/demo2 ":target=_self")

@nitzantomer
Copy link
Author

Works like a charm.
Thanks a lot for this product.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants