mkdocs-onecompiler-plugin


Namemkdocs-onecompiler-plugin JSON
Version 0.1.0 PyPI version JSON
download
home_page
SummaryInclude OneCompiler online compiler to your mkdocs website
upload_time2023-08-21 12:25:16
maintainer
docs_urlNone
authorAlban Siffer
requires_python>=3.11,<4.0
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # mkdocs-onecompiler-plugin

Include [OneCompiler](https://onecompiler.com/) online compiler to your mkdocs website.

## Requirements

Works only with [`mkdocs-material`](https://squidfunk.github.io/mkdocs-material/) as it ships a [pymdownx custom fence](https://facelessuser.github.io/pymdown-extensions/extensions/superfences/#custom-fences).

## Installation

```shell
pip install mkdocs-onecompiler-plugin
```

## Configuration

Here is a minimal configuration to use the onecompiler fence

```yaml
# mkdocs.yml
theme:
  name: material

markdown_extensions:
  - attr_list
  - pymdownx.superfences:
      custom_fences:
        - name: onecompiler
          class: onecompiler
          format: !!python/name:mkdocs_onecompiler_plugin.formatter
```

## Usage

The bare minimum is to provide the language.

````md
```{.onecompiler lang="python"}
a = 3
b = 5
c = a + b
print(c)
```
````

![result](assets/screenshot0.png)

Then we can use all the [OneCompiler API](https://onecompiler.com/cheatsheets/onecompiler-apis) to tweak the iframe.

````md
```{.onecompiler lang="python" listenToEvents=true filename="example.py" hideNew=true hideStdin=true hideNewFileOption=true hideTitle=true theme="dark" height="200px"}
a = 3
b = 5
c = a + b
print(c)
```
````

![result](assets/screenshot2.png)

## Debug

We can access formatter parameters when `debug=true` is passed to the attributes.

````md
```{.onecompiler .test #wtfid lang="python" listenToEvents=true filename="example.py" hideNew=true hideStdin=true hideNewFileOption=true hideTitle=true theme="dark" debug=true}
a = 3
b = 5
c = a + b
print(c)
```
````

You must run `mkdocs` with the verbose flag `-v` to print debug messages.

```shell
...
INFO    -  Building documentation...
DEBUG   -  Running 1 `config` events
INFO    -  Cleaning site directory
DEBUG   -  Reading markdown pages.
DEBUG   -  Reading: index.md
DEBUG   -  mkdocs_onecompiler_plugin: source: a = 3
           b = 5
           c = a + b
           print(c)
DEBUG   -  mkdocs_onecompiler_plugin: language: onecompiler
DEBUG   -  mkdocs_onecompiler_plugin: css_class: onecompiler
DEBUG   -  mkdocs_onecompiler_plugin: options: {}
DEBUG   -  mkdocs_onecompiler_plugin: md: <markdown.core.Markdown object at
           0x7f5f917bb6d0>
DEBUG   -  mkdocs_onecompiler_plugin: attrs: {'lang': 'python', 'listenToEvents': 'true',
           'filename': 'example.py', 'hideNew': 'true', 'hideStdin': 'true',
           'hideNewFileOption': 'true', 'hideTitle': 'true', 'theme': 'dark', 'height':
           '200px'}
DEBUG   -  mkdocs_onecompiler_plugin: classes: ['test']
DEBUG   -  mkdocs_onecompiler_plugin: id_value: wtfid2
DEBUG   -  mkdocs_onecompiler_plugin: kwargs: {}
DEBUG   -  mkdocs_onecompiler_plugin: debug: True
DEBUG   -  mkdocs_onecompiler_plugin:
           <iframe id="wtfid2" referrerpolicy="no-referrer" name="wtfid2"
           class="onecompiler test"
           src="https://onecompiler.com/embed/python?availableLanguages=true&hideLanguageSelection=false&hideNew=true&hideNewFileOption=true&disableCopyPaste=false&hideStdin=true&hideResult=false&hideTitle=true&listenToEvents=true&theme=dark"
           height="200px" width="100%" onload='this.contentWindow.postMessage({
                   eventType: "populateCode",
                   language: "python",
                   files: [
                       {
                           "name": "example.py",
                           "content": String.raw`a = 3
           b = 5
           c = a + b
           print(c)`
                       }
                   ]
               }, "*");'>
           </iframe>
DEBUG   -  Copying static assets.
...
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "mkdocs-onecompiler-plugin",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.11,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Alban Siffer",
    "author_email": "alban.siffer@irisa.fr",
    "download_url": "https://files.pythonhosted.org/packages/ec/76/f8a519af9b6ccbb38072c0374453258ab1442c4816fe65d8d51c6c43de07/mkdocs_onecompiler_plugin-0.1.0.tar.gz",
    "platform": null,
    "description": "# mkdocs-onecompiler-plugin\n\nInclude [OneCompiler](https://onecompiler.com/) online compiler to your mkdocs website.\n\n## Requirements\n\nWorks only with [`mkdocs-material`](https://squidfunk.github.io/mkdocs-material/) as it ships a [pymdownx custom fence](https://facelessuser.github.io/pymdown-extensions/extensions/superfences/#custom-fences).\n\n## Installation\n\n```shell\npip install mkdocs-onecompiler-plugin\n```\n\n## Configuration\n\nHere is a minimal configuration to use the onecompiler fence\n\n```yaml\n# mkdocs.yml\ntheme:\n  name: material\n\nmarkdown_extensions:\n  - attr_list\n  - pymdownx.superfences:\n      custom_fences:\n        - name: onecompiler\n          class: onecompiler\n          format: !!python/name:mkdocs_onecompiler_plugin.formatter\n```\n\n## Usage\n\nThe bare minimum is to provide the language.\n\n````md\n```{.onecompiler lang=\"python\"}\na = 3\nb = 5\nc = a + b\nprint(c)\n```\n````\n\n![result](assets/screenshot0.png)\n\nThen we can use all the [OneCompiler API](https://onecompiler.com/cheatsheets/onecompiler-apis) to tweak the iframe.\n\n````md\n```{.onecompiler lang=\"python\" listenToEvents=true filename=\"example.py\" hideNew=true hideStdin=true hideNewFileOption=true hideTitle=true theme=\"dark\" height=\"200px\"}\na = 3\nb = 5\nc = a + b\nprint(c)\n```\n````\n\n![result](assets/screenshot2.png)\n\n## Debug\n\nWe can access formatter parameters when `debug=true` is passed to the attributes.\n\n````md\n```{.onecompiler .test #wtfid lang=\"python\" listenToEvents=true filename=\"example.py\" hideNew=true hideStdin=true hideNewFileOption=true hideTitle=true theme=\"dark\" debug=true}\na = 3\nb = 5\nc = a + b\nprint(c)\n```\n````\n\nYou must run `mkdocs` with the verbose flag `-v` to print debug messages.\n\n```shell\n...\nINFO    -  Building documentation...\nDEBUG   -  Running 1 `config` events\nINFO    -  Cleaning site directory\nDEBUG   -  Reading markdown pages.\nDEBUG   -  Reading: index.md\nDEBUG   -  mkdocs_onecompiler_plugin: source: a = 3\n           b = 5\n           c = a + b\n           print(c)\nDEBUG   -  mkdocs_onecompiler_plugin: language: onecompiler\nDEBUG   -  mkdocs_onecompiler_plugin: css_class: onecompiler\nDEBUG   -  mkdocs_onecompiler_plugin: options: {}\nDEBUG   -  mkdocs_onecompiler_plugin: md: <markdown.core.Markdown object at\n           0x7f5f917bb6d0>\nDEBUG   -  mkdocs_onecompiler_plugin: attrs: {'lang': 'python', 'listenToEvents': 'true',\n           'filename': 'example.py', 'hideNew': 'true', 'hideStdin': 'true',\n           'hideNewFileOption': 'true', 'hideTitle': 'true', 'theme': 'dark', 'height':\n           '200px'}\nDEBUG   -  mkdocs_onecompiler_plugin: classes: ['test']\nDEBUG   -  mkdocs_onecompiler_plugin: id_value: wtfid2\nDEBUG   -  mkdocs_onecompiler_plugin: kwargs: {}\nDEBUG   -  mkdocs_onecompiler_plugin: debug: True\nDEBUG   -  mkdocs_onecompiler_plugin:\n           <iframe id=\"wtfid2\" referrerpolicy=\"no-referrer\" name=\"wtfid2\"\n           class=\"onecompiler test\"\n           src=\"https://onecompiler.com/embed/python?availableLanguages=true&hideLanguageSelection=false&hideNew=true&hideNewFileOption=true&disableCopyPaste=false&hideStdin=true&hideResult=false&hideTitle=true&listenToEvents=true&theme=dark\"\n           height=\"200px\" width=\"100%\" onload='this.contentWindow.postMessage({\n                   eventType: \"populateCode\",\n                   language: \"python\",\n                   files: [\n                       {\n                           \"name\": \"example.py\",\n                           \"content\": String.raw`a = 3\n           b = 5\n           c = a + b\n           print(c)`\n                       }\n                   ]\n               }, \"*\");'>\n           </iframe>\nDEBUG   -  Copying static assets.\n...\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Include OneCompiler online compiler to your mkdocs website",
    "version": "0.1.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3356f1b931e1cdba7b00674b344cd0aa348107202e4e5af44d13dc5acea2b554",
                "md5": "b43a0cfb5b56bb365b820953f9bc352d",
                "sha256": "d1a5cd12c8c4b4ce3c8da0ce86602fb55d9e952667065a84407a1205f11a37f3"
            },
            "downloads": -1,
            "filename": "mkdocs_onecompiler_plugin-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b43a0cfb5b56bb365b820953f9bc352d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11,<4.0",
            "size": 5457,
            "upload_time": "2023-08-21T12:25:15",
            "upload_time_iso_8601": "2023-08-21T12:25:15.480640Z",
            "url": "https://files.pythonhosted.org/packages/33/56/f1b931e1cdba7b00674b344cd0aa348107202e4e5af44d13dc5acea2b554/mkdocs_onecompiler_plugin-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ec76f8a519af9b6ccbb38072c0374453258ab1442c4816fe65d8d51c6c43de07",
                "md5": "6c14a43bcee1f6d4ffe1c9270865c808",
                "sha256": "4ea0b2fc73b77cbaf0f27c62373e54e48dded2c83cf96ae8d87e4552666c9b83"
            },
            "downloads": -1,
            "filename": "mkdocs_onecompiler_plugin-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "6c14a43bcee1f6d4ffe1c9270865c808",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11,<4.0",
            "size": 4393,
            "upload_time": "2023-08-21T12:25:16",
            "upload_time_iso_8601": "2023-08-21T12:25:16.720418Z",
            "url": "https://files.pythonhosted.org/packages/ec/76/f8a519af9b6ccbb38072c0374453258ab1442c4816fe65d8d51c6c43de07/mkdocs_onecompiler_plugin-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-21 12:25:16",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "mkdocs-onecompiler-plugin"
}
        
Elapsed time: 0.13707s