-
Notifications
You must be signed in to change notification settings - Fork 62
Open
Labels
Description
In dart-archive/markdown#585 I and later @srawlins sort of agreed that exposing *Syntax
objects is probably a bad idea. We could document that, so consumers don't have to come to the same realization, or we could change the public API.
This is a controversial proposal, feel free to shoot it down and close the issue.
It's certainly possible that some users might be hard to migrate.
Proposed public API
- Export a
List<Node> markdown(String text, {options...})
function- Options consist of booleans and
Resolver
. - Options can only enable/disable features.
- Users cannot inject a custom parser or custom syntax into the mix.
- Options consist of booleans and
- Mark everything with
@Deprecated('Use the markdown() function')
- Except
Node
,Element
,Text
andResolver
. - Add an
extension RenderHtml on List<Node> { String renderHtml(options...) {...} }
- Except
Next major version break
- Stop exporting all the deprecated things
- Annotate
Node
withsealed class
- Annotate
Text
andElement
withfinal class
This would prevent users from trying to make custom *Syntax
classes, reorder Syntax
classes, and get all sorts of weird behavior.
It would also allow us to refactor the implementation and add new features without breaking existing users.
Maybe, we keep all the internals as they are, but exposing them to the public seems a bit scary.
isoossigurdm