-
-
Notifications
You must be signed in to change notification settings - Fork 180
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
chore: update to marked version 9 #474
Conversation
addc6f6
to
99feada
Compare
Hi @robertIsaac, Thanks for the PR, I was expecting breaking changes, marked went from v5 to v9 in a few months only. I'll review it and come back to you but at first glance it seems pretty descent! |
lib/src/markdown.service.ts
Outdated
private useExtensions() { | ||
if (this.extensions) { | ||
for (const ext of this.extensions) { | ||
marked.use(ext); |
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.
You may want to think about using a Marked instance to prevent adding the same extensions multiple times. Some extensions will do strange things when added multiple times.
import { Marked } from 'marked';
const marked = new Marked();
marked.use(...);
...
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
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.
@UziTech instead of creating an instance of marked, we can just make sure that marked.use(...)
is not called more than once with the extensions right?
cf4ddb7
to
c3b23e3
Compare
hi @UziTech I have addressed your comments, please review again and resolve the conversation if my change address them correctly |
hi @jfcere do you plan to merge this soon? |
Hi @robertIsaac, First, let me say a big thank you for doing the migration, and also a special thanks to @UziTech for reviewing it! Because this is a breaking change, this cannot be merged in the master branch so I will have to create a release branch for the next major release. Also, the So, long story short, yes I will merge but this won't be available until Angular 17 is released which is due for next week according to their release schedule. I might start working on the next release this weekend, if you are in a hurry I can release an alpha version with those changes without the Angular 17 migration. |
okay I will modify the |
Of course that would really be appreciated :) |
another thing I want to do, to add prettier (or dprint) for the project if it's okay for you |
a42791b
to
e0467bb
Compare
done
|
e0467bb
to
d277af4
Compare
Hi @robertIsaac, I've created a new branch for the next release and changed the target branch for your PR. As there were changes to update I am going to review your changes afterward and this should be merged real soon in the next release branch. |
a new token `MARKDOWN_EXTENSIONS` has been added to provide extensions to marked usage example ``` { provide: MARKDOWN_EXTENSIONS, useValue: [gfmHeadingId()], } ``` update `readme.md` file - removed from the examples all the options that were removed - added section for the new marked extension token - removed the part that we need to add node_modules/marked/marked.min.js to our scripts since it's not needed breaking change - all options that were removed from marked has been deleted from this library too, see more at https://marked.js.org/using_advanced#options - some methods now return `Promise<string>` instead of `string`, because marked is doing so - `srcRelativeLink` input is removed as the baseUrl option has been removed from marked, use https://www.npmjs.com/package/marked-base-url instead
d277af4
to
b77382b
Compare
@jfcere done |
@robertIsaac there are a few things I'd like to modify in your PR instead of pointing out everything and asking for you to do the changes. So I either do the changes directly in your PR or merge it and do another PR to adjust some stuff. But seeing that you have another PR based on this one, the changes will inevitably bring conflicts to your other PR... do you have a preference? |
… rejection so it's possible to override it in the unit test it starts with ɵ so IDE doesn't provide it in autocomplete suggestions
@jfcere @michaelfaith |
remove unused `loader` from the `MarkdownModuleConfig`
722ebc6
to
be713bf
Compare
uploading to coveralls is denied |
I just think that using a new instance of marked everytime is not necessary, only to call |
okay do your modifications in my branch I don't mind |
sorry I just saw this comment |
This PR will be merged into a temporary branch on ngx-markdown before merging into the next release branch to...
|
* chore: update to marked version 9 (#474) * chore: update to marked version 9 * Update README.md * test: fix the Marked testing by providing it using Angular dependency rejection * feat: add `extensions` to the `MarkdownModuleConfig` * Revert "feat: add `extensions` to the `MarkdownModuleConfig`" * Re-add extensions to the MarkdownModuleConfig * Add missing unit tests --------- Co-authored-by: jfcere <[email protected]> * Add removed unit tests * Rename markdown-extentions file * Injection tokens uniformization * Add async pipe to MarkdownPipe demo and documentation * Remove marked.min.js from angular.json * Fix overriding of renderer functions * Fix named import lint error --------- Co-authored-by: robertIsaac <[email protected]> Co-authored-by: jfcere <[email protected]>
* chore: update to marked version 9 (#474) * chore: update to marked version 9 * Update README.md * test: fix the Marked testing by providing it using Angular dependency rejection * feat: add `extensions` to the `MarkdownModuleConfig` * Revert "feat: add `extensions` to the `MarkdownModuleConfig`" * Re-add extensions to the MarkdownModuleConfig * Add missing unit tests --------- Co-authored-by: jfcere <[email protected]> * Add removed unit tests * Rename markdown-extentions file * Injection tokens uniformization * Add async pipe to MarkdownPipe demo and documentation * Remove marked.min.js from angular.json * Fix overriding of renderer functions * Fix named import lint error --------- Co-authored-by: robertIsaac <[email protected]> Co-authored-by: jfcere <[email protected]>
New features and enhancements
The property
markedExtensions
has been added toMarkdownModuleConfig
allowing to use marked extensions when configuringMarkdownModule
.⚠ Breaking changes
Promise<string>
instead ofstring
, because marked is doing sosrcRelativeLink
input property is removed as thebaseUrl
option has been removed from marked, use https://www.npmjs.com/package/marked-base-url insteadMarkdownPipe
now returnsPromise<string>
instead ofstring
and will need to be combined withasync
pipe to work correctly