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

fix(content): fix deprecation warnings for marked package #487

Merged
merged 5 commits into from
Jun 29, 2023
Merged

fix(content): fix deprecation warnings for marked package #487

merged 5 commits into from
Jun 29, 2023

Conversation

luishcastroc
Copy link
Contributor

@luishcastroc luishcastroc commented Jun 26, 2023

Fixed by adding the new extensions as well added a test

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

Which package are you modifying?

  • vite-plugin-angular
  • vite-plugin-nitro
  • astro-angular
  • create-analog
  • router
  • platform
  • content
  • nx-plugin
  • trpc

What is the current behavior?

When serving the application and prerendering routes, a console warning is shown for the marked package

marked(): highlight and langPrefix parameters are deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-highlight.
marked(): mangle parameter is enabled by default, but is deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install https://www.npmjs.com/package/marked-mangle, or disable by setting `{mangle: false}`.
marked(): headerIds and headerPrefix parameters enabled by default, but are deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install  https://www.npmjs.com/package/marked-gfm-heading-id, or disable by setting `{headerIds: false}`.

Closes #482

What is the new behavior?

After the fix no warning should appear.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

[optional] What gif best describes this PR or how it makes you feel?

Fixed by adding the new extensions as well added a test
@netlify
Copy link

netlify bot commented Jun 26, 2023

Deploy Preview for analog-blog ready!

Name Link
🔨 Latest commit 1afffc3
🔍 Latest deploy log https://app.netlify.com/sites/analog-blog/deploys/649cd475331aee000702ed2c
😎 Deploy Preview https://deploy-preview-487--analog-blog.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@netlify
Copy link

netlify bot commented Jun 26, 2023

Deploy Preview for analog-docs ready!

Name Link
🔨 Latest commit 1afffc3
🔍 Latest deploy log https://app.netlify.com/sites/analog-docs/deploys/649cd475b82e8c00093ceb3f
😎 Deploy Preview https://deploy-preview-487--analog-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@netlify
Copy link

netlify bot commented Jun 26, 2023

Deploy Preview for analog-app ready!

Name Link
🔨 Latest commit 1afffc3
🔍 Latest deploy log https://app.netlify.com/sites/analog-app/deploys/649cd475bb1b3a00088a9f16
😎 Deploy Preview https://deploy-preview-487--analog-app.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@luishcastroc
Copy link
Contributor Author

luishcastroc commented Jun 26, 2023

#482 Hope this works 🥇

@brandonroberts
Copy link
Member

Thanks @luishcastroc! Things aren't rendering correctly now comparing the deploy preview against the current version

https://deploy-preview-487--analog-blog.netlify.app/blog/2022-12-31-my-second-post
https://analog-blog.netlify.app/blog/2022-12-31-my-second-post

If you go to https://deploy-preview-487--analog-blog.netlify.app/blog and click "My Second Post", it doesn't show the code snippet. If you refresh the page, it shows correctly.

The e2e test failure is unrelated so don't worry about that for now.

@luishcastroc
Copy link
Contributor Author

Thanks @luishcastroc! Things aren't rendering correctly now comparing the deploy preview against the current version

https://deploy-preview-487--analog-blog.netlify.app/blog/2022-12-31-my-second-post https://analog-blog.netlify.app/blog/2022-12-31-my-second-post

If you go to https://deploy-preview-487--analog-blog.netlify.app/blog and click "My Second Post", it doesn't show the code snippet. If you refresh the page, it shows correctly.

The e2e test failure is unrelated so don't worry about that for now.

Thanks i really didn't know how to test it properly so i gave it a shot but with that i can now tell for sure, let me give it a look

@luishcastroc
Copy link
Contributor Author

@brandonroberts i think it should be fixed now however e2e seems to be still failing.

@brandonroberts
Copy link
Member

@luishcastroc works as expected!

Question: What do you think about turning the Marked object into an Injectable service? Like a marked.service.ts class that's provided/injected into the MarkdownContentRenderService internally?

It would still behave like a singleton.

@luishcastroc
Copy link
Contributor Author

@luishcastroc works as expected!

Question: What do you think about turning the Marked object into an Injectable service? Like a marked.service.ts class that's provided/injected into the MarkdownContentRenderService internally?

It would still behave like a singleton.

i was thinking on this however since all the logic was inside the service i just complemented with the new approach, i think since this is an angular ecosystem it definitely makes sense so let me do the proper changes.

thanks for the feedback.

@luishcastroc
Copy link
Contributor Author

@luishcastroc works as expected!

Question: What do you think about turning the Marked object into an Injectable service? Like a marked.service.ts class that's provided/injected into the MarkdownContentRenderService internally?

It would still behave like a singleton.

@brandonroberts i sent a commit with the markedService injected in root but i wanted to know in your experience if that would be the best approach (seems to be straight forward after that). another one i tried was this.

export function withMarkdownRenderer(): Provider {
  return {
    provide: ContentRenderer,
    useClass: MarkdownContentRendererService,
    deps: [MarkedSetupService],
  };
}

export function provideContent(...features: Provider[]) {
  return [...features, MarkedSetupService];
}

not sure if that would be the best

@brandonroberts
Copy link
Member

@luishcastroc I think it should follow the same pattern as the provider and not use providedIn: 'root'. That way if you want to lazy load the provideContent you can

Copy link
Member

@brandonroberts brandonroberts left a comment

Choose a reason for hiding this comment

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

LGTM

@brandonroberts
Copy link
Member

Thanks for pushing through @luishcastroc! We'll need to add a migration for the new dependencies but that can be done separately.

@brandonroberts brandonroberts merged commit 87a978b into analogjs:main Jun 29, 2023
@brandonroberts
Copy link
Member

@allcontributors add @luishcastroc for code

@allcontributors
Copy link
Contributor

@brandonroberts

I've put up a pull request to add @luishcastroc! 🎉

@luishcastroc
Copy link
Contributor Author

Thanks for pushing through @luishcastroc! We'll need to add a migration for the new dependencies but that can be done separately.

let me read a little bit about how to do this and I'll take a look

Villanuevand pushed a commit to Villanuevand/analog that referenced this pull request Sep 12, 2023
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.

Feature: Fix deprecation warnings for marked package
2 participants