Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 03-May-2022 | - | ||||
jsx/ | H | 26-Apr-2019 | - | 61 | 49 | |
tests/ | H | 26-Apr-2019 | - | 575 | 536 | |
.bumpversion.cfg | H A D | 26-Apr-2019 | 185 | 11 | 8 | |
.coveragerc | H A D | 26-Apr-2019 | 84 | 9 | 6 | |
.gitignore | H A D | 26-Apr-2019 | 84 | 10 | 9 | |
.travis.yml | H A D | 26-Apr-2019 | 268 | 21 | 20 | |
LICENSE | H A D | 26-Apr-2019 | 1 KiB | 19 | 16 | |
Makefile | H A D | 26-Apr-2019 | 132 | 8 | 6 | |
README.rst | H A D | 26-Apr-2019 | 1.8 KiB | 81 | 62 | |
setup.py | H A D | 26-Apr-2019 | 952 | 37 | 32 |
README.rst
1jsx-lexer 2========= 3 4.. image:: https://travis-ci.org/fcurella/jsx-lexer.svg?branch=master 5 :target: https://travis-ci.org/fcurella/jsx-lexer 6 7.. image:: https://coveralls.io/repos/github/fcurella/jsx-lexer/badge.svg?branch=master 8 :target: https://coveralls.io/github/fcurella/jsx-lexer?branch=master 9 10A JSX lexer for Pygments 11 12Installation 13------------ 14.. code-block:: sh 15 16 $ pip install jsx-lexer 17 18Usage with Sphinx 19----------------- 20 21To use within Sphinx, simply specify ``jsx`` for your ``code-block``:: 22 23 .. code-block:: jsx 24 25 const BlogTitle = ({ children }) => ( 26 <h3>{children}</h3> 27 ); 28 // class component 29 class BlogPost extends React.Component { 30 renderTitle(title) { 31 return <BlogTitle>{title}</BlogTitle> 32 }; 33 render() { 34 return ( 35 <div className="blog-body"> 36 {this.renderTitle(this.props.title)} 37 <p>{this.props.body}</p> 38 </div> 39 ); 40 } 41 } 42 43Usage with mkdocs 44----------------- 45 46First, you need to create the ``CSS`` for the highlighting: 47 48.. code-block:: bash 49 50 $ pygmentize -S default -f html -a .codehilite > code/pygments.css 51 52Then, add the following to your ``mkdocs.yml``: 53 54.. code-block:: yaml 55 56 markdown_extensions: 57 - codehilite 58 extra_css: [pygments.css] 59 60Now, you can use ``jsx`` in your code blocks:: 61 62 ```jsx 63 const BlogTitle = ({ children }) => ( 64 <h3>{children}</h3> 65 ); 66 // class component 67 class BlogPost extends React.Component { 68 renderTitle(title) { 69 return <BlogTitle>{title}</BlogTitle> 70 }; 71 render() { 72 return ( 73 <div className="blog-body"> 74 {this.renderTitle(this.props.title)} 75 <p>{this.props.body}</p> 76 </div> 77 ); 78 } 79 } 80 ``` 81