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

Add remarkRehypeOptions and rehypeStringifyOptions to provide options to default Markdown processors #203

Closed
wants to merge 2 commits into from
Closed

Add remarkRehypeOptions and rehypeStringifyOptions to provide options to default Markdown processors #203

wants to merge 2 commits into from

Conversation

causztic
Copy link

#202

This is the minimum amount of work to allow custom options to be passed to the default processors to allow raw HTML tags among other things

Let me know if automated tests are required (I don't see any for the existing code in markdown.ts..)

Here are some screenshots that were taken during testing (using examples/next-contentlayer-example):

Screenshot 2022-04-30 at 3 17 03 PM

When the options are excluded, there are no errors


With the following options in examples/next-contentlayer-example/contentlayer.config.ts

  markdown: {
    remarkRehypeOptions: { allowDangerousHtml: true },
    rehypeStringifyOptions: { allowDangerousHtml: true }
  }

Screenshot 2022-04-30 at 3 16 31 PM

When including the options, it is passed down correctly and renders raw HTML as expected

@changeset-bot
Copy link

changeset-bot bot commented Apr 30, 2022

🦋 Changeset detected

Latest commit: 0c23653

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@contentlayer/core Patch
@contentlayer/cli Patch
@contentlayer/client Patch
@contentlayer/source-contentful Patch
@contentlayer/source-files Patch
@contentlayer/source-sanity Patch
contentlayer-stackbit-yaml-generator Patch
contentlayer Patch
next-contentlayer Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@causztic
Copy link
Author

Not sure whether I did the changeset properly (this is new to me!), please let me know if it's done wrongly

@schickling
Copy link
Collaborator

Thanks a lot for this PR @causztic. Closing based on our chat in Discord and given the upcoming 0.2.5 release (see here)

@schickling schickling closed this May 10, 2022
@causztic causztic deleted the 202-allow-custom-options-for-default-md-processors branch May 11, 2022 02:26
@causztic
Copy link
Author

Thank you for the work! 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants