Skip to main content
https://travis-ci.org/fcurella/jsx-lexer.svg?branch=master https://coveralls.io/repos/github/fcurella/jsx-lexer/badge.svg?branch=master

A JSX lexer for Pygments

Installation

$ pip install jsx-lexer

Usage with Sphinx

To use within Sphinx, simply specify jsx for your code-block:

.. code-block:: jsx

    const BlogTitle = ({ children }) => (
      <h3>{children}</h3>
    );
    // class component
    class BlogPost extends React.Component {
      renderTitle(title) {
        return <BlogTitle>{title}</BlogTitle>
      };
      render() {
        return (
        <div className="blog-body">
          {this.renderTitle(this.props.title)}
          <p>{this.props.body}</p>
        </div>
        );
      }
    }

Usage with mkdocs

First, you need to create the CSS for the highlighting:

$ pygmentize -S default -f html -a .codehilite > code/pygments.css

Then, add the following to your mkdocs.yml:

markdown_extensions:
  - codehilite
extra_css: [pygments.css]

Now, you can use jsx in your code blocks:

```jsx
const BlogTitle = ({ children }) => (
  <h3>{children}</h3>
);
// class component
class BlogPost extends React.Component {
  renderTitle(title) {
    return <BlogTitle>{title}</BlogTitle>
  };
  render() {
    return (
    <div className="blog-body">
      {this.renderTitle(this.props.title)}
      <p>{this.props.body}</p>
    </div>
    );
  }
}
```

Release files for jsx-lexer 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jsx-lexer 0.0.5
File Size Uploaded
jsx-lexer-0.0.5.tar.gz 2.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jsx-lexer 0.0.5
File Interpreter ABI Platform
jsx_lexer-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 7.1 kB

Release files / jsx-lexer-0.0.5.tar.gz

Download URL jsx-lexer-0.0.5.tar.gz
Size 2.7 kB
Tags Source
SHA-256 checksum
How to use checksums
031620f0aaf5353e4fac86d8921c54b41ccdb1173678fd0eb230bcace665d33e
BLAKE2b-256 checksum
How to use checksums
05f123a1dd2f66dde09a4dc2a67c9ef368093f0f7ae14da5020af1852385eff0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / jsx_lexer-0.0.5-py3-none-any.whl

Download URL jsx_lexer-0.0.5-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c5c1c4e746fc09369d29bc4c96f79b61801ad4b1fdf975f183d8138b8d87d4e7
BLAKE2b-256 checksum
How to use checksums
4917605991bec695d1e5575afe8ff064aa1bbd3c431dea2c424bf720f2f8bd10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

2.0.1

2 release files

2.0.0

2 release files

1.0.0

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page