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

No documentation for the simplest usage #57

Open
NannoSilver opened this issue Jul 31, 2024 · 1 comment
Open

No documentation for the simplest usage #57

NannoSilver opened this issue Jul 31, 2024 · 1 comment

Comments

@NannoSilver
Copy link

NannoSilver commented Jul 31, 2024

Hi,

This library is interesting and, according to this demo, it does exactly what I am looking for.

The library documentation shows how to add handler and other things, but does not show how to use for a very simple task, that is, convert link to somewhere.com into link to <a href="https://somewhere.com">somewhere.com</a>

I searched for examples across the internet, but could not find.

I tried the following code, but it does not works:

from linkify_it import LinkifyIt


linkify = LinkifyIt()

a = "link to somewhere.com"

result = linkify(a)

print(result)

Can you tell me how to do it?

@tsutsu3
Copy link
Owner

tsutsu3 commented Nov 3, 2024

Plese Use markdown-it-py.

from markdown_it import MarkdownIt

md = MarkdownIt("commonmark", {"linkify": True}).enable(["linkify"])

a = "link to somewhere.com"

print(md.render(a))
# <p>link to <a href="http://somewhere.com">somewhere.com</a></p>

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

No branches or pull requests

2 participants