Skip to content

mistake in readme example? #122

@dbvisel

Description

@dbvisel

The longest example in README.md contains this code:

const options = {
  replace: ({ attribs, children }) => {
    if (!attribs) return;

    if (attribs.id === 'main') {
      return (
        <h1 style={{ fontSize: 42 }}>{domToReact(children, parserOptions)}</h1>
      );
    }

    if (attribs.class === 'prettify') {
      return (
        <span style={{ color: 'hotpink' }}>
          {domToReact(children, parserOptions)}
        </span>
      );
    }
  }
};

It's calling domToReact with parserOptions (undefined in the example) as the second option. Shouldn't that be options?

Thanks for a useful package!

Activity

remarkablemark

remarkablemark commented on Oct 1, 2019

@remarkablemark
Owner

Yes, great catch @dbvisel! Would you like the honors of opening a pull request to fix this?

dbvisel

dbvisel commented on Oct 1, 2019

@dbvisel
ContributorAuthor

Happy to do it!

added a commit that references this issue on Oct 1, 2019
4f9263b
added a commit that references this issue on Oct 3, 2019
b49ee28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationhelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      mistake in readme example? · Issue #122 · remarkablemark/html-react-parser