refactor!: 2.0
2.0
BREAKING CHANGES. Re-wrote the whole library. Corrected a lot of mistakes I made when I first wrote it.
Closes #1, as I think its better to handle TG markdown in the plugin itself. Not in this library.
A lot have been changed:
Changelog
-
Switched to marked from marky for parsing Markdown to HTML.
-
Removed
parseMarkdownandparseHTMLin favor of a common methodparsewhich takes two arguments: content and parse mode. (Closes #4 as it also tries to solve this in a different way)import { parse } from "https://deno.land/x/telegraph/mod.ts"; const content = parse("**Bold**", "Markdown"); const content = parse("<b>Bold</b>", "Markdown"); -
Removed
setupAccountmethod and the abilities to create or edit account directly by passing it to the constructor. I think the new API is much clean. -
uploadfunction was improved.- Added ability to change API url.
-
Supports installing an error handler to catch and manage errors as you like. (Thanks to grammyjs/grammY)
-
Types have been improved.
-
iframe URLs are no longer transformed like it used to do. Now it only appends the URI encoded URL to
/embed/{}?url={}after validation. -
HTML is sanitized before parsing.
-
Line breaks have been improved.
-
docs: API reference documentation is copied to the code. So, users can have documentation right in their editor. Closes #2
#3 is still pending and need to be worked on before merging this.