-
Notifications
You must be signed in to change notification settings - Fork 23
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
Consider refractor #41
Comments
Wow @wooorm ! That's an impressive work! One thine that concerns me is the usage on browser: https://github.com/wooorm/refractor#browser
Not sure how I should adapt this along with the current |
Maybe I should provide them two components, one is the original The other one would be var refractor = require('refractor/core.js');
var jsx = require('refractor/lang/jsx.js');
refractor.register(jsx);
render(<PrismRefactor>{'JSX CODE'}</PrismRefactor>); |
Even better: var { PrismRefactor} = require('react-prism');
require('react-prism/register/refractor/lang/jsx'); // Which will call refractor.register(jsx); in that file
render(<PrismRefactor>{'JSX CODE'}</PrismRefactor>); |
Thank you!
Normal buildIncluding all languages. import {PrismCode} from "react-prism";
// ... Light buildIncludes only core languages. import {PrismCode, register} from 'react-prism/light';
import js from 'react-prism/lang/javascript';
register(js);
// ... You could also do the auto-register thing, but then languages need to require the light build themselves, and they won’t export anything, which I personally think is a bit weird, but 🤷♂️ |
Hi folks! 👋
Shameless plug, but you should consider using
refractor
! It provides syntax highlighting using Prism, but outputs a virtual DOM instead of HTML (so you don’t usedangerouslySetInnerHTML
any more), plus it uses CommonJS instead of globals! If you’d switch, you wouldn’t have to ask people to includeprism.js
(fixing #30)As an aside, I also maintain
lowlight
, which is likerefractor
but wraps highlight.js, and is used inreact-syntax-highlighter
!The text was updated successfully, but these errors were encountered: