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

HyperMD + react-codemirror #26

Closed
cgestes opened this issue May 23, 2018 · 9 comments
Closed

HyperMD + react-codemirror #26

cgestes opened this issue May 23, 2018 · 9 comments

Comments

@cgestes
Copy link
Contributor

cgestes commented May 23, 2018

Hi guys,

Thank you for this awesome project.

As I was saying in #21 I cannot get HyperMD (the typescript version) to work with react-codemirror.

I made a really simple test case to investigate but I couldn't find the issue.

Demo:
https://github.com/cgestes/react-hypermd-demo

Any idea how I can find what is wrong with this demo?

@cgestes
Copy link
Contributor Author

cgestes commented May 23, 2018

Please not that switching the mode to gfm works. (using the hypermd-light theme)

@laobubu
Copy link
Owner

laobubu commented May 23, 2018

Have you tried mode: "hypermd" ?
If still not working, I'll check it tomorrow

@laobubu
Copy link
Owner

laobubu commented May 23, 2018

Looks like react-codemirror 's build has a outdated CodeMirror inside (see https://github.com/JedWatson/react-codemirror/tree/master/dist ), which lacks some features to support HyperMD.

Try setting <ReactCodeMirror>'s prop codeMirrorInstance={ require("codemirror") }

@cgestes
Copy link
Contributor Author

cgestes commented May 23, 2018

I'll try and keep you posted, thank you ;)

@cgestes
Copy link
Contributor Author

cgestes commented May 24, 2018

Thank you for the leads.

Here are the results:

  • setting mode to hypermd doesnt work.
  • setting the codemirror instance to codemirror v5.38 doesnt help
  • deduplicating codemirror only v5.38 (just in case) doesnt help

(I added to commit to force codemirror version)

Any new ideas?

@cgestes
Copy link
Contributor Author

cgestes commented May 24, 2018

Got it to work...

It does work with the npm published version, but not when using yarn link.

@cgestes
Copy link
Contributor Author

cgestes commented May 24, 2018

nailed it...

The issue was a duplication of the codemirror instance when using yarn link.

I fixed it by putting codemirror in peerDependencies instead of dependencies.

@cgestes
Copy link
Contributor Author

cgestes commented May 24, 2018

I guess we can close this one.

@cgestes cgestes closed this as completed May 24, 2018
@cgestes
Copy link
Contributor Author

cgestes commented May 24, 2018

see #27

ryooo pushed a commit to ryooo/HyperMD that referenced this issue Nov 20, 2020
feat: renderPreview is now more customizable
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

No branches or pull requests

2 participants