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

[feature request]: strip custom prefix from links #376

Open
jalil-salame opened this issue Dec 8, 2024 · 4 comments
Open

[feature request]: strip custom prefix from links #376

jalil-salame opened this issue Dec 8, 2024 · 4 comments
Labels
enhancement New feature or request needs-further-input Further information is required from the reporter

Comments

@jalil-salame
Copy link

jalil-salame commented Dec 8, 2024

Zola (static site generator) uses a [name](@/path/to/file.md) syntax to resolve links (e.g. [blog](@/blog/_index.md) will resolve to href="/blog/" once compiled, and it points to the blog/_index.md file).

By stripping the @/ prefix from the link (option in config.toml ideally) this could be supported, otherwise you just get a warning Link to non-existent document '@/blog/_index.md'.

My suggestion is to add a strip_link_prefix™️ option to the configuration, this could be a single string or a list? (maybe someone needs this?), and before checking if the link is valid, this prefix would be stripped from it.

@artempyanykh
Copy link
Owner

Hi @jalil-salame! This sounds reasonable, but I'm guessing you'd still like other features like completion and rename refactor to put the @/ prefix into the link, right?

@artempyanykh artempyanykh added enhancement New feature or request needs-further-input Further information is required from the reporter labels Dec 9, 2024
@jalil-salame
Copy link
Author

Hi @jalil-salame! This sounds reasonable, but I'm guessing you'd still like other features like completion and rename refactor to put the @/ prefix into the link, right?

My use is fairly small so I don't mind lacking the @/ in completions as Zola will just fail to build with an error

@artempyanykh
Copy link
Owner

Fair enough! Although, I think that UX-wise the feature would feel somewhat incomplete without the support in completion and refactoring.

@rywng
Copy link

rywng commented Dec 18, 2024

Hello, I'm also using zola and marksman, I am able to workaround this issue by doing the following steps:

  1. In your root directory, ln -s content @
  2. touch .marksman.toml
  3. in your markdown files, you should now be able to complete the texts, but it is automatically parsed to something like [text](/%40/_index.md)
  4. replace the /%40 to @, I use a one-liner: rg /%40 -l | xargs sed -i "s/\/%40/\@/"
  5. It should work now, I have tested goto definition, and the warning @jalil-salame mentioned is gone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs-further-input Further information is required from the reporter
Projects
None yet
Development

No branches or pull requests

3 participants