pax_global_header 0000666 0000000 0000000 00000000064 14225761650 0014522 g ustar 00root root 0000000 0000000 52 comment=7070bc1e858bb531cabb296278a74738cdc1639d jupyterlab_pygments-0.2.2/ 0000775 0000000 0000000 00000000000 14225761650 0015632 5 ustar 00root root 0000000 0000000 jupyterlab_pygments-0.2.2/.eslintignore 0000664 0000000 0000000 00000000053 14225761650 0020333 0 ustar 00root root 0000000 0000000 node_modules dist coverage **/*.d.ts tests jupyterlab_pygments-0.2.2/.eslintrc.js 0000664 0000000 0000000 00000002002 14225761650 0020063 0 ustar 00root root 0000000 0000000 module.exports = { extends: [ 'eslint:recommended', 'plugin:@typescript-eslint/eslint-recommended', 'plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended' ], parser: '@typescript-eslint/parser', parserOptions: { project: 'tsconfig.json', sourceType: 'module' }, plugins: ['@typescript-eslint'], rules: { '@typescript-eslint/naming-convention': [ 'error', { selector: 'interface', format: ['PascalCase'], custom: { regex: '^I[A-Z]', match: true } } ], '@typescript-eslint/no-unused-vars': ['warn', { args: 'none' }], '@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/no-namespace': 'off', '@typescript-eslint/no-use-before-define': 'off', '@typescript-eslint/quotes': [ 'error', 'single', { avoidEscape: true, allowTemplateLiterals: false } ], curly: ['error', 'all'], eqeqeq: 'error', 'prefer-arrow-callback': 'error' } }; jupyterlab_pygments-0.2.2/.github/ 0000775 0000000 0000000 00000000000 14225761650 0017172 5 ustar 00root root 0000000 0000000 jupyterlab_pygments-0.2.2/.github/workflows/ 0000775 0000000 0000000 00000000000 14225761650 0021227 5 ustar 00root root 0000000 0000000 jupyterlab_pygments-0.2.2/.github/workflows/binder-on-pr.yml 0000664 0000000 0000000 00000002113 14225761650 0024243 0 ustar 00root root 0000000 0000000 # Reference https://mybinder.readthedocs.io/en/latest/howto/gh-actions-badges.html name: Binder Badge on: pull_request_target: types: [opened] permissions: pull-requests: write jobs: binder: runs-on: ubuntu-latest steps: - name: comment on PR with Binder link uses: actions/github-script@v3 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | var PR_HEAD_USERREPO = process.env.PR_HEAD_USERREPO; var PR_HEAD_REF = process.env.PR_HEAD_REF; github.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, body: `[](https://mybinder.org/v2/gh/${PR_HEAD_USERREPO}/${PR_HEAD_REF}?urlpath=lab) :point_left: Launch a Binder on branch _${PR_HEAD_USERREPO}/${PR_HEAD_REF}_` }) env: PR_HEAD_REF: ${{ github.event.pull_request.head.ref }} PR_HEAD_USERREPO: ${{ github.event.pull_request.head.repo.full_name }} jupyterlab_pygments-0.2.2/.github/workflows/build.yml 0000664 0000000 0000000 00000003305 14225761650 0023052 0 ustar 00root root 0000000 0000000 name: Build on: push: branches: main pull_request: branches: '*' jobs: build: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - name: Base Setup uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 - name: Install dependencies run: python -m pip install -U jupyterlab~=3.1 check-manifest - name: Build the extension run: | set -eux jlpm jlpm lint:check python -m pip install . jupyter labextension list 2>&1 | grep -ie "jupyterlab_pygments.*OK" python -m jupyterlab.browser_check check-manifest -v pip install build python -m build --sdist cp dist/*.tar.gz myextension.tar.gz pip uninstall -y "jupyterlab_pygments" jupyterlab rm -rf myextension - uses: actions/upload-artifact@v2 with: name: myextension-sdist path: myextension.tar.gz test_isolated: needs: build runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - name: Install Python uses: actions/setup-python@v2 with: python-version: '3.8' architecture: 'x64' - uses: actions/download-artifact@v2 with: name: myextension-sdist - name: Install and Test run: | set -eux # Remove NodeJS, twice to take care of system and locally installed node versions. sudo rm -rf $(which node) sudo rm -rf $(which node) pip install myextension.tar.gz pip install jupyterlab jupyter labextension list 2>&1 | grep -ie "jupyterlab_pygments.*OK" python -m jupyterlab.browser_check --no-chrome-test jupyterlab_pygments-0.2.2/.github/workflows/check-release.yml 0000664 0000000 0000000 00000003316 14225761650 0024450 0 ustar 00root root 0000000 0000000 name: Check Release on: push: branches: - main pull_request: branches: - main permissions: contents: write jobs: check_release: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - name: Install Python uses: actions/setup-python@v2 with: python-version: 3.9 architecture: 'x64' - name: Install node uses: actions/setup-node@v2 with: node-version: '14.x' - name: Get pip cache dir id: pip-cache run: | echo "::set-output name=dir::$(pip cache dir)" - name: Cache pip uses: actions/cache@v1 with: path: ${{ steps.pip-cache.outputs.dir }} key: ${{ runner.os }}-pip-${{ hashFiles('package.json') }} restore-keys: | ${{ runner.os }}-pip- - name: Cache checked links uses: actions/cache@v2 with: path: ~/.cache/pytest-link-check key: ${{ runner.os }}-linkcheck-${{ hashFiles('**/.md') }}-md-links restore-keys: | ${{ runner.os }}-linkcheck- - name: Upgrade packaging dependencies run: | pip install --upgrade pip setuptools wheel jupyter-packaging~=0.10 --user - name: Install Dependencies run: | pip install . - name: Check Release uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v1 with: token: ${{ secrets.GITHUB_TOKEN }} - name: Upload Distributions uses: actions/upload-artifact@v2 with: name: jupyterlab_pygments-releaser-dist-${{ github.run_number }} path: .jupyter_releaser_checkout/dist jupyterlab_pygments-0.2.2/.gitignore 0000664 0000000 0000000 00000002754 14225761650 0017632 0 ustar 00root root 0000000 0000000 *.bundle.* lib/ node_modules/ .eslintcache .stylelintcache *.egg-info/ .ipynb_checkpoints *.tsbuildinfo jupyterlab_pygments/labextension # Created by https://www.gitignore.io/api/python # Edit at https://www.gitignore.io/?templates=python ### Python ### # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ pip-wheel-metadata/ share/python-wheels/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover .hypothesis/ .pytest_cache/ # Translations *.mo *.pot # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder target/ # pyenv .python-version # celery beat schedule file celerybeat-schedule # SageMath parsed files *.sage.py # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # Mr Developer .mr.developer.cfg .project .pydevproject # mkdocs documentation /site # mypy .mypy_cache/ .dmypy.json dmypy.json # Pyre type checker .pyre/ # End of https://www.gitignore.io/api/python # OSX files .DS_Store # Generated pygments CSS style/base.css jupyterlab_pygments-0.2.2/.prettierignore 0000664 0000000 0000000 00000000110 14225761650 0020665 0 ustar 00root root 0000000 0000000 node_modules **/node_modules **/lib **/package.json jupyterlab_pygments jupyterlab_pygments-0.2.2/.prettierrc 0000664 0000000 0000000 00000000117 14225761650 0020015 0 ustar 00root root 0000000 0000000 { "singleQuote": true, "trailingComma": "none", "arrowParens": "avoid" } jupyterlab_pygments-0.2.2/.stylelintrc 0000664 0000000 0000000 00000000405 14225761650 0020206 0 ustar 00root root 0000000 0000000 { "extends": [ "stylelint-config-recommended", "stylelint-config-standard", "stylelint-prettier/recommended" ], "rules": { "property-no-vendor-prefix": null, "selector-no-vendor-prefix": null, "value-no-vendor-prefix": null, } } jupyterlab_pygments-0.2.2/CHANGELOG.md 0000664 0000000 0000000 00000000126 14225761650 0017442 0 ustar 00root root 0000000 0000000 # Changelog jupyterlab_pygments-0.2.2/LICENSE 0000664 0000000 0000000 00000002751 14225761650 0016644 0 ustar 00root root 0000000 0000000 Copyright (c) 2015 Project Jupyter Contributors All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. jupyterlab_pygments-0.2.2/MANIFEST.in 0000664 0000000 0000000 00000000666 14225761650 0017400 0 ustar 00root root 0000000 0000000 include LICENSE include *.md include pyproject.toml include package.json include install.json include ts*.json include yarn.lock include generate_css.py graft jupyterlab_pygments/labextension # Javascript files graft src graft style prune **/node_modules prune lib prune binder # Patterns to exclude from any directory global-exclude *~ global-exclude *.pyc global-exclude *.pyo global-exclude .git global-exclude .ipynb_checkpoints jupyterlab_pygments-0.2.2/README.md 0000664 0000000 0000000 00000002676 14225761650 0017124 0 ustar 00root root 0000000 0000000 # JupyterLab Pygments Theme This package contains a syntax coloring theme for [pygments](http://pygments.org/) making use of the JupyterLab CSS variables. The goal is to enable the use of JupyterLab's themes with pygments-generated HTML. ## Screencast In the following screencast, we demonstrate how Pygments-highlighted code can make use of the JupyterLab theme.  ## Installation `jupyterlab_pygments` can be installed with the conda package manager ``` conda install -c conda-forge jupyterlab_pygments ``` or from pypi ``` pip install jupyterlab_pygments ``` ## Dependencies - `jupyterlab_pygments` requires [pygments](http://pygments.org) version `2.4.1`. - The CSS variables used by the theme correspond to the CodeMirror syntex coloring theme defined in the NPM package [@jupyterlab/codemirror](https://www.npmjs.com/package/@jupyterlab/codemirror). Supported versions for `@jupyterlab/codemirror`'s CSS include `0.19.1`, `^1.0`, and, `^2.0`. ## Limitations Pygments-generated HTML and CSS classes are not granular enough to reproduce all of the details of codemirror (the JavaScript text editor used by JupyterLab). This includes the ability to differentiate properties from general names. ## License `jupyterlab_pygments` uses a shared copyright model that enables all contributors to maintain the copyright on their contributions. All code is licensed under the terms of the revised [BSD license](LICENSE). jupyterlab_pygments-0.2.2/RELEASE.md 0000664 0000000 0000000 00000003555 14225761650 0017244 0 ustar 00root root 0000000 0000000 # Making a new release of jupyterlab_pygments The extension can be published to `PyPI` and `npm` manually or using the [Jupyter Releaser](https://github.com/jupyter-server/jupyter_releaser). ## Manual release ### Python package This extension can be distributed as Python packages. All of the Python packaging instructions in the `pyproject.toml` file to wrap your extension in a Python package. Before generating a package, we first need to install `build`. ```bash pip install build twine ``` To create a Python source package (`.tar.gz`) and the binary package (`.whl`) in the `dist/` directory, do: ```bash python -m build ``` > `python setup.py sdist bdist_wheel` is deprecated and will not work for this package. Then to upload the package to PyPI, do: ```bash twine upload dist/* ``` ### NPM package To publish the frontend part of the extension as a NPM package, do: ```bash npm login npm publish --access public ``` ## Automated releases with the Jupyter Releaser The extension repository should already be compatible with the Jupyter Releaser. Check out the [workflow documentation](https://github.com/jupyter-server/jupyter_releaser#typical-workflow) for more information. Here is a summary of the steps to cut a new release: - Fork the [`jupyter-releaser` repo](https://github.com/jupyter-server/jupyter_releaser) - Add `ADMIN_GITHUB_TOKEN`, `PYPI_TOKEN` and `NPM_TOKEN` to the Github Secrets in the fork - Go to the Actions panel - Run the "Draft Changelog" workflow - Merge the Changelog PR - Run the "Draft Release" workflow - Run the "Publish Release" workflow ## Publishing to `conda-forge` If the package is not on conda forge yet, check the documentation to learn how to add it: https://conda-forge.org/docs/maintainer/adding_pkgs.html Otherwise a bot should pick up the new version publish to PyPI, and open a new PR on the feedstock repository automatically. jupyterlab_pygments-0.2.2/binder/ 0000775 0000000 0000000 00000000000 14225761650 0017075 5 ustar 00root root 0000000 0000000 jupyterlab_pygments-0.2.2/binder/environment.yml 0000664 0000000 0000000 00000000721 14225761650 0022164 0 ustar 00root root 0000000 0000000 # a mybinder.org-ready environment for demoing jupyterlab_pygments # this environment may also be used locally on Linux/MacOS/Windows, e.g. # # conda env update --file binder/environment.yml # conda activate jupyterlab-pygments-demo # name: jupyterlab-pygments-demo channels: - conda-forge dependencies: # runtime dependencies - python >=3.8,<3.9.0a0 - jupyterlab >=3,<4.0.0a0 # labextension build dependencies - nodejs >=14,<15 - pip - wheel jupyterlab_pygments-0.2.2/binder/postBuild 0000775 0000000 0000000 00000002504 14225761650 0020771 0 ustar 00root root 0000000 0000000 #!/usr/bin/env python3 """ perform a development install of jupyterlab_pygments On Binder, this will run _after_ the environment has been fully created from the environment.yml in this directory. This script should also run locally on Linux/MacOS/Windows: python3 binder/postBuild """ import subprocess import sys from pathlib import Path ROOT = Path.cwd() def _(*args, **kwargs): """ Run a command, echoing the args fails hard if something goes wrong """ print("\n\t", " ".join(args), "\n") return_code = subprocess.call(args, **kwargs) if return_code != 0: print("\nERROR", return_code, " ".join(args)) sys.exit(return_code) # verify the environment is self-consistent before even starting _(sys.executable, "-m", "pip", "check") # install the labextension _(sys.executable, "-m", "pip", "install", "-e", ".") _(sys.executable, "-m", "jupyter", "labextension", "develop", "--overwrite", ".") # verify the environment the extension didn't break anything _(sys.executable, "-m", "pip", "check") # list the extensions _("jupyter", "server", "extension", "list") # initially list installed extensions to determine if there are any surprises _("jupyter", "labextension", "list") print("JupyterLab with jupyterlab_pygments is ready to run with:\n") print("\tjupyter lab\n") jupyterlab_pygments-0.2.2/generate_css.py 0000664 0000000 0000000 00000001755 14225761650 0020656 0 ustar 00root root 0000000 0000000 """Generates pygments style sheet from jupyterlab-pygments. Source: https://github.com/jupyterlab/jupyterlab_pygments """ from pathlib import Path from jupyterlab_pygments import JupyterStyle from pygments.formatters import HtmlFormatter prefix = """ /*----------------------------------------------------------------------------- | Copyright (c) Jupyter Development Team. | Distributed under the terms of the Modified BSD License. |----------------------------------------------------------------------------*/ /* This file was auto-generated by generate_css.py in jupyterlab_pygments */ """ def main(): formatter = HtmlFormatter(style=JupyterStyle) css = formatter.get_style_defs('.highlight') highlight_css = '\n'.join(filter( lambda line: line.startswith('.highlight'), css.splitlines() )) here = Path(__file__).parent style_file = here / "style" / "base.css" style_file.write_text("\n".join((prefix, highlight_css))) if __name__ == "__main__": main() jupyterlab_pygments-0.2.2/install.json 0000664 0000000 0000000 00000000307 14225761650 0020173 0 ustar 00root root 0000000 0000000 { "packageManager": "python", "packageName": "jupyterlab_pygments", "uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package jupyterlab_pygments" } jupyterlab_pygments-0.2.2/jupyterlab_pygments/ 0000775 0000000 0000000 00000000000 14225761650 0021741 5 ustar 00root root 0000000 0000000 jupyterlab_pygments-0.2.2/jupyterlab_pygments/__init__.py 0000664 0000000 0000000 00000000321 14225761650 0024046 0 ustar 00root root 0000000 0000000 from ._version import __version__ # noqa from .style import JupyterStyle # noqa def _jupyter_labextension_paths(): return [{ "src": "labextension", "dest": "jupyterlab_pygments" }] jupyterlab_pygments-0.2.2/jupyterlab_pygments/_version.py 0000664 0000000 0000000 00000000257 14225761650 0024143 0 ustar 00root root 0000000 0000000 # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. version_info = (0, 2, 2) __version__ = '.'.join(map(str, version_info)) jupyterlab_pygments-0.2.2/jupyterlab_pygments/style.py 0000664 0000000 0000000 00000020454 14225761650 0023460 0 ustar 00root root 0000000 0000000 # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. from pygments.style import Style from pygments.token import ( Comment, Error, Generic, Keyword, Literal, Name, Number, Operator, Other, Punctuation, String, Text, Whitespace) class JupyterStyle(Style): """ A pygments style using JupyterLab CSS variables. The goal is to mimick JupyterLab's codemirror theme. Known impossibilities: - With pygments, the dot in `foo.bar` is considered an Operator (class: 'o'), while in codemirror, it is bare text. - With pygments, in both `from foo import bar`, and `foo.bar`, "bar" is considered a Name (class: 'n'), while in coremirror, the latter is a property. Available CSS variables are --jp-mirror-editor-keyword-color --jp-mirror-editor-atom-color --jp-mirror-editor-number-color --jp-mirror-editor-def-color --jp-mirror-editor-variable-color --jp-mirror-editor-variable-2-color --jp-mirror-editor-variable-3-color --jp-mirror-editor-punctuation-color --jp-mirror-editor-property-color --jp-mirror-editor-operator-color --jp-mirror-editor-comment-color --jp-mirror-editor-string-color --jp-mirror-editor-string-2-color --jp-mirror-editor-meta-color --jp-mirror-editor-qualifier-color --jp-mirror-editor-builtin-color --jp-mirror-editor-bracket-color --jp-mirror-editor-tag-color --jp-mirror-editor-attribute-color --jp-mirror-editor-header-color --jp-mirror-editor-quote-color --jp-mirror-editor-link-color --jp-mirror-editor-error-color """ default_style = '' background_color = 'var(--jp-cell-editor-background)' highlight_color = 'var(--jp-cell-editor-active-background)' styles = { Text: 'var(--jp-mirror-editor-variable-color)', # no class Whitespace: '', # class: 'w' Error: 'var(--jp-mirror-editor-error-color)', # class: 'err' Other: '', # class: 'x' Comment: 'italic var(--jp-mirror-editor-comment-color)', # class: 'c' #Comment.Multiline: '', # class: 'cm' #Comment.Preproc: '', # class: 'cp' #Comment.Single: '', # class: 'c1' #Comment.Special: '', # class: 'cs' Keyword: 'bold var(--jp-mirror-editor-keyword-color)', # class: 'k' #Keyword.Constant: '', # class: 'kc' #Keyword.Declaration: '', # class: 'kd' #Keyword.Namespace: '', # class: 'kn' #Keyword.Pseudo: '', # class: 'kp' #Keyword.Reserved: '', # class: 'kr' #Keyword.Type: '', # class: 'kt' Operator: 'bold var(--jp-mirror-editor-operator-color)', # class: 'o' Operator.Word: '', # class: 'ow' Literal: '', # class: 'l' Literal.Date: '', # class: 'ld' String: 'var(--jp-mirror-editor-string-color)', #String.Backtick: '', # class: 'sb' #String.Char: '', # class: 'sc' #String.Doc: '', # class: 'sd' #String.Double: '', # class: 's2' #String.Escape: '', # class: 'se' #String.Heredoc: '', # class: 'sh' #String.Interpol: '', # class: 'si' #String.Other: '', # class: 'sx' #String.Regex: '', # class: 'sr' #String.Single: '', # class: 's1' #String.Symbol: '', # class: 'ss' Number: 'var(--jp-mirror-editor-number-color)', # class: 'm' #Number.Float: '', # class: 'mf' #Number.Hex: '', # class: 'mh' #Number.Integer: '', # class: 'mi' #Number.Integer.Long: '', # class: 'il' #Number.Oct: '', # class: 'mo' Name: '', # class: 'n' #Name.Attribute: '', # class: 'na' #Name.Builtin: '', # class: 'nb' #Name.Builtin.Pseudo: '', # class: 'bp' #Name.Class: '', # class: 'nc' #Name.Constant: '', # class: 'no' #Name.Decorator: '', # class: 'nd' #Name.Entity: '', # class: 'ni' #Name.Exception: '', # class: 'ne' #Name.Function: '', # class: 'nf' #Name.Property: '', # class 'py' #Name.Label: '', # class: 'nl' #Name.Namespace: '', # class: 'nn' #Name.Other: '', # class: 'nx' #Name.Tag: '', # class: 'nt' #Name.Variable: '', # class: 'nv' #Name.Variable.Class: '', # class: 'vc' #Name.Variable.Global: '', # class: 'vg' #Name.Variable.Instance: '', # class: 'vi' Generic: '', # class: 'g' #Generic.Deleted: '', # class: 'gd', #Generic.Emph: 'italic', # class: 'ge' #Generic.Error: '', # class: 'gr' #Generic.Heading: '', # class: 'gh' #Generic.Inserted: '', # class: 'gi' #Generic.Output: '', # class: 'go' #Generic.Prompt: '', # class: 'gp' #Generic.Strong: '', # class: 'gs' #Generic.Subheading: '', # class: 'gu' #Generic.Traceback: '', # class: 'gt' Punctuation: 'var(--jp-mirror-editor-punctuation-color)' # class: 'p' } jupyterlab_pygments-0.2.2/notebooks/ 0000775 0000000 0000000 00000000000 14225761650 0017635 5 ustar 00root root 0000000 0000000 jupyterlab_pygments-0.2.2/notebooks/Example.ipynb 0000664 0000000 0000000 00000003043 14225761650 0022273 0 ustar 00root root 0000000 0000000 { "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from pygments import highlight\n", "from pygments.lexers import PythonLexer\n", "from pygments.formatters import HtmlFormatter\n", "from jupyterlab_pygments import JupyterStyle" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "class PythonCode:\n", " def __init__(self, value):\n", " self.value = value\n", " \n", " def _repr_html_(self, **kwargs):\n", " formatter = HtmlFormatter(style=JupyterStyle)\n", " html = highlight(self.value, PythonLexer(), formatter)\n", " return f'