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

Render output with rehype-react #213

Merged
merged 1 commit into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## [Unreleased](https://github.com/zooniverse/markdownz/tree/master) (2023-10-30)
Remove `dangerouslySetInnerHTML`. Render the HTML output with `rehype-react`.

**Full Changelog**: https://github.com/zooniverse/markdownz/compare/v8.5.0...master

## [v8.5.0](https://github.com/zooniverse/markdownz/tree/8.5.0) (2023-10-30)
Add a `useMarkdownz` hook.

Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# markdownz [![Build Status](https://travis-ci.org/zooniverse/markdownz.svg?branch=master)](https://travis-ci.org/zooniverse/markdownz)

Markdown viewer, editor, and help components for the [Zooniverse](https://www.zooniverse.org). Requires React 15.
Markdown viewer, editor, and help components for the [Zooniverse](https://www.zooniverse.org). Requires React 16.8 or higher.

## Usage

Expand All @@ -10,6 +10,8 @@ This package contains three publicly accessible components: a Markdown viewer an

Viewer:

Parse markdown to HTML with `markdown-it`, then render the result as a React component tree with `rehype-react`.

```jsx
import { Markdown } from 'markdownz';

Expand Down Expand Up @@ -70,8 +72,10 @@ const html = useMarkdownz({ content: 'This is some markdown', debug: true })
| property | default | effect |
|----------|:-------:|--------|
| children | `null` | Markdown String to Render |
| components | `null` | Rehype component mappings for the parsed output |
| content | `''` | Markdown String to Render used if `this.props.children` is null |
| debug | `false` | Return error messages, if true, for easier debugging |
| settings | `{}` | Rehype settings for the parsed output |
| tag | `div` | HTML tag to wrap markdown content with |
| className | `''` | css classes for the element |
| project | `null` | Panoptes project for links |
Expand Down
Loading