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)
| File | Size | Uploaded | |
|---|---|---|---|
| jsx-lexer-0.0.5.tar.gz | 2.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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 |