-
-
Notifications
You must be signed in to change notification settings - Fork 75
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
Add autolink (linkify) functionality to Markdown #101
Add autolink (linkify) functionality to Markdown #101
Conversation
) | ||
) | ||
.build() | ||
} | ||
|
||
val astRootNode by produceState<AstNode?>(null, text) { | ||
val astRootNode by produceState<AstNode?>(null, text, options) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parser should be a key to this produceState since it can change according to options.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! I had used options
as the key for parser
above, and for some reason re-used the same key here instead of using parser
🤦
val autolink: Boolean | ||
) { | ||
public companion object { | ||
public fun getDefaults(): MarkdownParseOptions = MarkdownParseOptions( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit; you can make this a Default
val instead of re-allocating with every function call
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
Adds MarkdownParseOptions which allows consumers of the library to control whether or not the autolink functionality is enabled. Note the behaviour change: autolink is enabled with the new MarkdownParseOptions defaults.
2eef844
to
9556d65
Compare
Thanks 🎉 |
PR updates the commonmark-java dependency to 0.20.0 and introduces autolink (linkify) functionality.
I have added
MarkdownParseOptions
which allows consumers of the library to control whether or not the autolink functionality is enabled. Addresses #95Note: autolink is enabled with the new MarkdownParseOptions defaults, which means there is a minor (but worth mentioning) behaviour change here.
Short demo:
device-2022-10-22-135749.mp4