{"id":16948618,"url":"https://github.com/fcurella/jsx-lexer","last_synced_at":"2025-03-17T08:37:04.589Z","repository":{"id":37484584,"uuid":"91104552","full_name":"fcurella/jsx-lexer","owner":"fcurella","description":"a JSX lexer for pygments","archived":false,"fork":false,"pushed_at":"2023-05-16T15:16:22.000Z","size":71,"stargazers_count":39,"open_issues_count":8,"forks_count":12,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-27T21:37:06.914Z","etag":null,"topics":["docs","jsx","pygments","python","sphinx"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fcurella.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-12T15:22:42.000Z","updated_at":"2024-12-02T18:31:20.000Z","dependencies_parsed_at":"2024-06-18T18:25:30.314Z","dependency_job_id":"b4be3418-daa0-41c4-876c-61b453d91ac1","html_url":"https://github.com/fcurella/jsx-lexer","commit_stats":{"total_commits":43,"total_committers":9,"mean_commits":4.777777777777778,"dds":0.2325581395348837,"last_synced_commit":"04d486dfa97ea78383dfeab3875396d43ba0f6de"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcurella%2Fjsx-lexer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcurella%2Fjsx-lexer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcurella%2Fjsx-lexer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcurella%2Fjsx-lexer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fcurella","download_url":"https://codeload.github.com/fcurella/jsx-lexer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243852484,"owners_count":20358271,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docs","jsx","pygments","python","sphinx"],"created_at":"2024-10-13T21:51:40.153Z","updated_at":"2025-03-17T08:37:04.328Z","avatar_url":"https://github.com/fcurella.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"jsx-lexer\n=========\n\n.. image:: https://travis-ci.org/fcurella/jsx-lexer.svg?branch=master\n    :target: https://travis-ci.org/fcurella/jsx-lexer\n\n.. image:: https://coveralls.io/repos/github/fcurella/jsx-lexer/badge.svg?branch=master\n    :target: https://coveralls.io/github/fcurella/jsx-lexer?branch=master\n\nA JSX lexer for Pygments\n\nInstallation\n------------\n.. code-block:: sh\n\n    $ pip install jsx-lexer\n\nUsage with Sphinx\n-----------------\n\nTo use within Sphinx, simply specify ``jsx`` for your ``code-block``::\n\n    .. code-block:: jsx\n\n        const BlogTitle = ({ children }) =\u003e (\n          \u003ch3\u003e{children}\u003c/h3\u003e\n        );\n        // class component\n        class BlogPost extends React.Component {\n          renderTitle(title) {\n            return \u003cBlogTitle\u003e{title}\u003c/BlogTitle\u003e\n          };\n          render() {\n            return (\n            \u003cdiv className=\"blog-body\"\u003e\n              {this.renderTitle(this.props.title)}\n              \u003cp\u003e{this.props.body}\u003c/p\u003e\n            \u003c/div\u003e\n            );\n          }\n        }\n\nUsage with mkdocs\n-----------------\n\nFirst, you need to create the ``CSS`` for the highlighting:\n\n.. code-block:: bash\n\n  $ pygmentize -S default -f html -a .codehilite \u003e code/pygments.css\n\nThen, add the following to your ``mkdocs.yml``:\n\n.. code-block:: yaml\n\n  markdown_extensions:\n    - codehilite\n  extra_css: [pygments.css]\n\nNow, you can use ``jsx`` in your code blocks::\n\n    ```jsx\n    const BlogTitle = ({ children }) =\u003e (\n      \u003ch3\u003e{children}\u003c/h3\u003e\n    );\n    // class component\n    class BlogPost extends React.Component {\n      renderTitle(title) {\n        return \u003cBlogTitle\u003e{title}\u003c/BlogTitle\u003e\n      };\n      render() {\n        return (\n        \u003cdiv className=\"blog-body\"\u003e\n          {this.renderTitle(this.props.title)}\n          \u003cp\u003e{this.props.body}\u003c/p\u003e\n        \u003c/div\u003e\n        );\n      }\n    }\n    ```\n\nUsage with Overleaf\n-------------------\n\nFirst, add the minted package in your main file:\n\n.. code-block:: latex\n\n    \\usepackage{minted}\n\nThen, download the `lexer.py`_ file from this project, and place it in your root folder in Overleaf.\n\n.. _lexer.py: jsx/lexer.py\n\nNow, you can use ``{lexer.py:JsxLexer -x}`` in front of your minted code blocks:\n\n.. code-block:: latex\n\n    \\begin{minted}{lexer.py:JsxLexer -x}\n        const BlogTitle = ({ children }) =\u003e (\n          \u003ch3\u003e{children}\u003c/h3\u003e\n        );\n        // class component\n        class BlogPost extends React.Component {\n          renderTitle(title) {\n            return \u003cBlogTitle\u003e{title}\u003c/BlogTitle\u003e\n          };\n          render() {\n            return (\n            \u003cdiv className=\"blog-body\"\u003e\n              {this.renderTitle(this.props.title)}\n              \u003cp\u003e{this.props.body}\u003c/p\u003e\n            \u003c/div\u003e\n            );\n          }\n        }\n    \\end{minted}\n\nYou can find an example of the lexer in use on Overleaf here: `https://www.overleaf.com/read/xvsytqzkvdjb`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffcurella%2Fjsx-lexer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffcurella%2Fjsx-lexer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffcurella%2Fjsx-lexer/lists"}