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

Conditionally process url instead of encoding #667

Open
marcselman opened this issue Sep 28, 2022 · 2 comments
Open

Conditionally process url instead of encoding #667

marcselman opened this issue Sep 28, 2022 · 2 comments
Labels

Comments

@marcselman
Copy link

marcselman commented Sep 28, 2022

Markdown links will automatically be URL encoded when turned into an HTML anchor.
Is it possible to process the url string instead of it gettingURL encoded?

For example:

This is [a test](#|MY_URL|#). Normal [link](https://url.com/my|title)

will be turned into:

This is <a href="#%7CMY_URL%7C#">a test</a>. Normal <a href="https://url.com/my%7Ctitle">link</a>

I want to match urls that start with #| and end with |# and replace that with *| and |* consecutively and skip url encoding (because it will be sent to another process that expects this format).
So that the output would be:

This is <a href="*|MY_URL|*">a test</a>. Normal <a href="https://url.com/my%7Ctitle">link</a>

Is that possible by creating an extension for example?

@xoofx xoofx added the question label Oct 5, 2022
@xoofx
Copy link
Owner

xoofx commented Oct 21, 2022

Is that possible by creating an extension for example?

Yes, there are many potential solutions, but maybe inheriting LinkInlineRenderer to override the default renderer and avoid the encoding is a good place to try.

@jjxtra
Copy link

jjxtra commented Mar 18, 2023

How to override / inherit in this way?

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

3 participants