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

Update marked lib to 9.0.0 (#474) #479

Merged
merged 9 commits into from
Nov 11, 2023
Merged

Update marked lib to 9.0.0 (#474) #479

merged 9 commits into from
Nov 11, 2023

Conversation

jfcere
Copy link
Owner

@jfcere jfcere commented Nov 8, 2023

New features and enhancements

The property markedExtensions has been added to MarkdownModuleConfig allowing to use marked extensions when configuring MarkdownModule.

MarkdownModule.forRoot({
  markedExtensions: [gfmHeadingId()],
}),

⚠ Breaking changes

  • All options that were removed from marked has been deleted from this library too, see more at https://marked.js.org/using_advanced#options
  • The srcRelativeLink input property is removed as the baseUrl option has been removed from marked, use https://www.npmjs.com/package/marked-base-url instead
  • Some methods now return Promise<string> instead of string, because marked is doing so
  • The MarkdownPipe now returns Promise<string> instead of string and will need to be combined with async pipe to work correctly
  • Both markedOptions and clipboardOptions configuration properties used in the MarkdownModule.forRoot(config: MarkdownModuleConfig) method now require to be provided with the MARKED_OPTIONS and CLIPBOARD_OPTIONS injection token.

Additional information

  • Including marked.min.js file in the scripts section of the angular.json when using @angular\cli is no longer needed and can safely be removed as it is automatically imported.

Special Thanks

🥇 Thanks to @robertIsaac for his contribution to update marked library and adding support for extensions.

Fix #457, #387, #266, #239

robertIsaac and others added 2 commits November 7, 2023 21:17
* chore: update to marked version 9

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

* Update README.md

* test: fix the Marked testing by providing it using Angular dependency rejection

so it's possible to override it in the unit test
it starts with ɵ so IDE doesn't provide it in autocomplete suggestions

* feat: add `extensions` to the `MarkdownModuleConfig`

remove unused `loader` from the `MarkdownModuleConfig`

* Revert "feat: add `extensions` to the `MarkdownModuleConfig`"

This reverts commit be713bf.

* Re-add extensions to the MarkdownModuleConfig

* Add missing unit tests

---------

Co-authored-by: jfcere <[email protected]>
@coveralls
Copy link

coveralls commented Nov 8, 2023

Coverage Status

coverage: 96.774% (-0.4%) from 97.194%
when pulling e5b62e5 on pr474
into a7a676e on version-17.0.0.

Copy link
Contributor

@robertIsaac robertIsaac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jfcere jfcere merged commit 14f4dea into version-17.0.0 Nov 11, 2023
@jfcere jfcere deleted the pr474 branch November 11, 2023 00:54
jfcere added a commit that referenced this pull request Nov 11, 2023
* 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]>
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

Successfully merging this pull request may close these issues.

3 participants