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

we need an option to ignore links from being compiled via list of matchers #1975

Open
trusktr opened this issue Jan 25, 2023 · 0 comments
Open

Comments

@trusktr
Copy link
Member

trusktr commented Jan 25, 2023

Feature request

We can add a new option called ignoreCompileLinks or similar.

What problem does this feature solve?

There is currently a way to ignore links with markdown syntax:

https://docsify.js.org/#/helpers?id=ignore-to-compile-link

However, this can be cumbersome if there are a lot of links. Also, if loading external markdown files, we have no control over the content.

There is already a similar option called crossOriginLinks:

https://docsify.js.org/#/configuration?id=crossoriginlinks

but that went away in #1967, and that option is not exactly the same. We might want to ignore certain links, and those links may or may not be cross-origin.

Non-cross-origin links can include certain URLs that are supposed to load a new page. F.e. example.com/usage/foo might load markdown with Docsify, but example.com/other/blah might load an entirely different non-Docsify page, or proxy to another domain.

Live example: https://docs.lume.io/three-meshline/. This site loads the content from https://lume.github.io/three-meshline/ due to my vercel proxy configuration in vercel.json (cc @jhildenbiddle you may find this interesting based on recent chat). Subsequently, this loaded content has all sorts of /three-meshline/foo links, but Docsify tries to handle them directly. Instead, I would like to have Docsify ignore any three-meshline/* links, and have the browser open those pages directly.

I could modify all those links myself such that they are of the format [foo](./bar ":ignore"), because I do own those pages, but a regex in my docsify config would be nicer.

What does the proposed API look like?

window.$docsify = {
  ignoreCompileLinks: [
    '/foo/bar', // string
    /.*foo\/.*/, // regex
  ]
}

How should this be implemented in your opinion?

In addition to markdown :ignore syntax, the compiler will look in this array and ignore any links that are matched.

Are you willing to work on this yourself?

Yeah

@trusktr trusktr changed the title we need an option to ignore links from being compiled we need an option to ignore links from being compiled via list of matchers Jan 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant