mkjsfiddle


Namemkjsfiddle JSON
Version 1.0.1 PyPI version JSON
download
home_pagehttps://github.com/stadiamaps/mkjsfiddle
SummaryAn MkDocs plugin that lets you edit code fences in JSFiddle.
upload_time2023-06-06 14:36:34
maintainer
docs_urlNone
authorStadia Maps
requires_python>=3.8, <4
licenseMIT
keywords mkdocs jsfiddle plugin
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # MkDocs JSFiddle Plugin

A plugin for [MkDocs](https://www.mkdocs.org/) that lets you
augment your code fences with an "Try it in JSFiddle" button.

## Installation

This package can be installed via pip.

```
pip install mkjsfiddle
```

Then, add `jsfiddle` to the `plugins` section of your `mkdocs.yml`
file.

```yaml
plugins:
  - jsfiddle
```

## Usage

Code fences will be left alone by default, as many code blocks may not
form a coherent block for a user to edit. To opt in for a given code fence,
add `jsfiddle-` to your fence language declaration, like so.

~~~markdown
```jsfiddle-html
<!DOCTYPE html>
<!-- Some content here -->
```
~~~

The `html` above will be preserved for syntax highlighting, and the
`jsfiddle-` will be dropped. Other languages are theoretically
supported, but will have no impact besides code highlighting.

The default behavior is for a simple HTML parser to extract the inline JS
and CSS elements and put their contents in the appropriate JSFiddle panels.
More specifically, if you have a `script` tag with the attribute `type=text/javascript`
AND not having the `src` attribute, or if you have a `style` tag with the attribute
`type=text/css`, it will be extracted to the appropriate panel. If you have multiple
of these, they will all be extracted and concatenated with some newlines thrown in as
breaks.

If you prefer to opt out of this behavior and just dump everything as-is into
the HTML box, you can add `-htmlonly` to the language string (for a full string that
looks something like `jsfiddle-html-htmlonly`).

## Known limitations

We attempt to keep formatting as-is, but make no guarantees in the default mode. The
`-htmlonly` option however should preserve formatting (if it does not, please submit
a bug report). This has been developed and tested with [Material for MkDocs](https://github.com/squidfunk/mkdocs-material),
and has not been tested extensively with additional styles. Pull requests to improve styling
are welcome.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/stadiamaps/mkjsfiddle",
    "name": "mkjsfiddle",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8, <4",
    "maintainer_email": "",
    "keywords": "mkdocs jsfiddle plugin",
    "author": "Stadia Maps",
    "author_email": "info@stadiamaps.com",
    "download_url": "https://files.pythonhosted.org/packages/f1/ef/bd43a2d9784ef36d2ea861462cd6a85a2b7e07be4c0f77a11e5dc9aea2b9/mkjsfiddle-1.0.1.tar.gz",
    "platform": null,
    "description": "# MkDocs JSFiddle Plugin\n\nA plugin for [MkDocs](https://www.mkdocs.org/) that lets you\naugment your code fences with an \"Try it in JSFiddle\" button.\n\n## Installation\n\nThis package can be installed via pip.\n\n```\npip install mkjsfiddle\n```\n\nThen, add `jsfiddle` to the `plugins` section of your `mkdocs.yml`\nfile.\n\n```yaml\nplugins:\n  - jsfiddle\n```\n\n## Usage\n\nCode fences will be left alone by default, as many code blocks may not\nform a coherent block for a user to edit. To opt in for a given code fence,\nadd `jsfiddle-` to your fence language declaration, like so.\n\n~~~markdown\n```jsfiddle-html\n<!DOCTYPE html>\n<!-- Some content here -->\n```\n~~~\n\nThe `html` above will be preserved for syntax highlighting, and the\n`jsfiddle-` will be dropped. Other languages are theoretically\nsupported, but will have no impact besides code highlighting.\n\nThe default behavior is for a simple HTML parser to extract the inline JS\nand CSS elements and put their contents in the appropriate JSFiddle panels.\nMore specifically, if you have a `script` tag with the attribute `type=text/javascript`\nAND not having the `src` attribute, or if you have a `style` tag with the attribute\n`type=text/css`, it will be extracted to the appropriate panel. If you have multiple\nof these, they will all be extracted and concatenated with some newlines thrown in as\nbreaks.\n\nIf you prefer to opt out of this behavior and just dump everything as-is into\nthe HTML box, you can add `-htmlonly` to the language string (for a full string that\nlooks something like `jsfiddle-html-htmlonly`).\n\n## Known limitations\n\nWe attempt to keep formatting as-is, but make no guarantees in the default mode. The\n`-htmlonly` option however should preserve formatting (if it does not, please submit\na bug report). This has been developed and tested with [Material for MkDocs](https://github.com/squidfunk/mkdocs-material),\nand has not been tested extensively with additional styles. Pull requests to improve styling\nare welcome.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "An MkDocs plugin that lets you edit code fences in JSFiddle.",
    "version": "1.0.1",
    "project_urls": {
        "Homepage": "https://github.com/stadiamaps/mkjsfiddle"
    },
    "split_keywords": [
        "mkdocs",
        "jsfiddle",
        "plugin"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "197bf95fe4b07a134e678d02e2d3466ab8fdcf17da4be1bc596dad582c4f308a",
                "md5": "f1788c374af2a4910f065c78905c5341",
                "sha256": "cbd8ce498f048bd23b50d475e337558cf2b9d03957d6b25fd1a2158998767c88"
            },
            "downloads": -1,
            "filename": "mkjsfiddle-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f1788c374af2a4910f065c78905c5341",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8, <4",
            "size": 6163,
            "upload_time": "2023-06-06T14:36:32",
            "upload_time_iso_8601": "2023-06-06T14:36:32.869955Z",
            "url": "https://files.pythonhosted.org/packages/19/7b/f95fe4b07a134e678d02e2d3466ab8fdcf17da4be1bc596dad582c4f308a/mkjsfiddle-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f1efbd43a2d9784ef36d2ea861462cd6a85a2b7e07be4c0f77a11e5dc9aea2b9",
                "md5": "6c42dcc9f47e288a724646b9b088b559",
                "sha256": "88563c248eeeeb367f46fe2605d3f80b6786bc41d27d2e3e640b76e5e270526b"
            },
            "downloads": -1,
            "filename": "mkjsfiddle-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "6c42dcc9f47e288a724646b9b088b559",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8, <4",
            "size": 6642,
            "upload_time": "2023-06-06T14:36:34",
            "upload_time_iso_8601": "2023-06-06T14:36:34.514424Z",
            "url": "https://files.pythonhosted.org/packages/f1/ef/bd43a2d9784ef36d2ea861462cd6a85a2b7e07be4c0f77a11e5dc9aea2b9/mkjsfiddle-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-06 14:36:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "stadiamaps",
    "github_project": "mkjsfiddle",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "mkjsfiddle"
}
        
Elapsed time: 0.07858s