Code Monkey home page Code Monkey logo

react-prism's People

Contributors

appleboy avatar eddywashere avatar emilyaviva avatar tomchentw avatar tuchk4 avatar wilcofiers avatar zerocho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

react-prism's Issues

global prism

It'd be nice to not require Prism to be exposed globally. I tried doing:

$ npm install prismjs react-prism

and rendering some components, but no such luck.

Error: Prism is not defined

i'm using version 1.2.1 and I'm getting the following error:

Uncaught ReferenceError: Prism is not defined PrismCode.js:29Uncaught Reference

Any ideas?

Plans to support editing?

As the title says, are there any plans? I'm looking to use something like this to make a web builder for React components.

language-regex doesn't work

I'm trying to use:

<PrismCode className="language-regex">{`/[a-z]{5}/g`}</PrismCode>

… which outputs:

<code class="  language-regex">/[a-z]{5}/g</code>

language-javascript, however, works perfectly. I know that prism has support for regex, so I'm trying to figure out why it wouldn't work here.


    "prismjs": "^1.20.0",
    "react-prism": "^4.3.2",

custom highlighting style

Is there anyway to change the color of the highlighting? I'm asking because I want it to match the style of the site.

Example too complicated to follow

I can't get visiblity on what actually goes in there.
I am unable to put this level of complexity into my project.
Do you have a bare bones static simple example?

[Question] How to add jsx event?

Hi,

I think Prism override React? e.g.

// this.state = { code: "import React from 'react';" };
  render() {
    return (
      <div>
        <code className="language-jsx">
          <span className="token keyword">import</span> <a onClick={this.handleClick} data-foo="abc" > React </a> <span className="token keyword">from</span> <span className="token string">'react'</span><span className="token punctuation">;</span>
        </code>
        <PrismCode className="language-jsx">
          {this.state.code}
        </PrismCode>
      </div>
    );
  }

the onClick is gone after render.

<div data-reactroot="">
  <code class=" language-jsx">
    <span class="token keyword">import</span> React <span class="token keyword">from</span> <span class="token string">'react'</span><span class="token punctuation">;</span>
  </code>
  <code class="  language-jsx">
    <span class="token keyword">import</span> React <span class="token keyword">from</span> <span class="token string">'react'</span><span class="token punctuation">;</span>
  </code>
</div>

So the question is how can I remain onClick there?

Thanks

Support for React 0.13

It would be nice if you support both React 0.13 and 0.14 as your peerDependencies. Since React 0.14 is fairly new and not all the projects have upgraded to 0.14.

As of npm 3.0.* peerDependencies are not automatically installed and running npm install gives warning in react-prism regarding React 0.14

Note: I am using React 0.13.3 in my project.

Consider refractor

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 use dangerouslySetInnerHTML any more), plus it uses CommonJS instead of globals! If you’d switch, you wouldn’t have to ask people to include prism.js (fixing #30)

As an aside, I also maintain lowlight, which is like refractor but wraps highlight.js, and is used in react-syntax-highlighter!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.