django-highlightjs


Namedjango-highlightjs JSON
Version 0.2.8 PyPI version JSON
download
home_pagehttps://github.com/mounirmesselmeni/django-highlightjs/
SummaryA Django app to easyily integrate highlight.js syntax highlighter.
upload_time2023-02-05 21:53:45
maintainer
docs_urlNone
authorMounir Messelmeni
requires_python>=3.8
licenseMIT
keywords django highlightjs syntax highlighter syntax highlighter highlight.js
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            =============================
Welcome to django-highlightjs
=============================

.. image:: https://github.com/mounirmesselmeni/django-highlightjs/actions/workflows/workflow.yml/badge.svg
  :target: https://github.com/mounirmesselmeni/django-highlightjs/actions?query=branch%3Amain++

.. image:: https://coveralls.io/repos/MounirMesselmeni/django-highlightjs/badge.png?branch=main
  :target: https://coveralls.io/r/MounirMesselmeni/django-highlightjs?branch=main


.. image:: https://img.shields.io/pypi/v/django-highlightjs.svg
    :target: https://pypi.python.org/pypi/django-highlightjs/
    :alt: Latest Version


Use Highlight.js (https://highlightjs.org) in your Django templates, the Django way.


Installation
------------

1. Install using pip:

   ``pip install django-highlightjs``

   Alternatively, you can install download or clone this repo and call ``pip install -e .``.

2. Add to INSTALLED_APPS in your ``settings.py``:

   ``'highlightjs',``

3. In your templates, load the ``highlightjs`` library and use the ``highlightjs_*`` tags:

Settings
--------

The django-highlightjs has some pre-configured settings.
They can be modified by adding a dict variable called ``HIGHLIGHTJS`` in your ``settings.py`` and customizing the values you want.
The ``HIGHLIGHTJS`` dict variable is contains these settings and defaults:

   .. code:: Python

    HIGHLIGHTJS = {
      # The URL to the jQuery JavaScript file
      'jquery_url': '//code.jquery.com/jquery.min.js',
      # The highlight.js base URL
      'base_url': '//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/highlight.min.js',
      # The complete URL to the highlight.js CSS file
      'css_url': '//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/styles/{0}.min.css',
      # Include jQuery with highlight.js JavaScript (affects django-highlightjs template tags)
      'include_jquery': False,
      # The default used style.
      'style': 'monokai_sublime',
      }


Usage in your `settings.py`:
   .. code:: Python

    HIGHLIGHTJS = {
      'style': 'github',
    }

All other styles available at https://github.com/isagalaev/highlight.js/tree/main/src/styles


Example template
----------------

   .. code:: Django

    {% load highlightjs %}
    <html>
    <head>
      <link href="{% highlightjs_css_url %}" rel='stylesheet' type='text/css'>
    </head>
    <body>
        {# Highlight Syntax using Highlightjs #}

        {% highlightjs_this code_to_highlight %}
        {% highlightjs_this code_to_highlight 'python' %}

        {% highlightjs_javascript jquery=1 %}
    </body>
    </html>


Requirements
------------

- Python 3.8, 3.9, 3.10 or 3.11
- Django >= 3

Contributions and pull requests for other Django and Python versions are welcome.


Bugs and requests
-----------------

If you have found a bug or if you have a request for additional functionality, please use the issue tracker on GitHub.

https://github.com/mounirmesselmeni/django-highlightjs/issues


License
-------

You can use this under MIT See `LICENSE
<LICENSE>`_ file for details.


Author
------

My name is Mounir Messelmeni, you can reach me at messelmeni.mounir@gmail.com .

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mounirmesselmeni/django-highlightjs/",
    "name": "django-highlightjs",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "django,highlightjs,syntax,highlighter,syntax highlighter,highlight.js",
    "author": "Mounir Messelmeni",
    "author_email": "messelmeni.mounir@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/7b/19/92780694ca723b5e06690678355369685b3e588f228dec5d6b92c610783e/django_highlightjs-0.2.8.tar.gz",
    "platform": null,
    "description": "=============================\nWelcome to django-highlightjs\n=============================\n\n.. image:: https://github.com/mounirmesselmeni/django-highlightjs/actions/workflows/workflow.yml/badge.svg\n  :target: https://github.com/mounirmesselmeni/django-highlightjs/actions?query=branch%3Amain++\n\n.. image:: https://coveralls.io/repos/MounirMesselmeni/django-highlightjs/badge.png?branch=main\n  :target: https://coveralls.io/r/MounirMesselmeni/django-highlightjs?branch=main\n\n\n.. image:: https://img.shields.io/pypi/v/django-highlightjs.svg\n    :target: https://pypi.python.org/pypi/django-highlightjs/\n    :alt: Latest Version\n\n\nUse Highlight.js (https://highlightjs.org) in your Django templates, the Django way.\n\n\nInstallation\n------------\n\n1. Install using pip:\n\n   ``pip install django-highlightjs``\n\n   Alternatively, you can install download or clone this repo and call ``pip install -e .``.\n\n2. Add to INSTALLED_APPS in your ``settings.py``:\n\n   ``'highlightjs',``\n\n3. In your templates, load the ``highlightjs`` library and use the ``highlightjs_*`` tags:\n\nSettings\n--------\n\nThe django-highlightjs has some pre-configured settings.\nThey can be modified by adding a dict variable called ``HIGHLIGHTJS`` in your ``settings.py`` and customizing the values you want.\nThe ``HIGHLIGHTJS`` dict variable is contains these settings and defaults:\n\n   .. code:: Python\n\n    HIGHLIGHTJS = {\n      # The URL to the jQuery JavaScript file\n      'jquery_url': '//code.jquery.com/jquery.min.js',\n      # The highlight.js base URL\n      'base_url': '//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/highlight.min.js',\n      # The complete URL to the highlight.js CSS file\n      'css_url': '//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/styles/{0}.min.css',\n      # Include jQuery with highlight.js JavaScript (affects django-highlightjs template tags)\n      'include_jquery': False,\n      # The default used style.\n      'style': 'monokai_sublime',\n      }\n\n\nUsage in your `settings.py`:\n   .. code:: Python\n\n    HIGHLIGHTJS = {\n      'style': 'github',\n    }\n\nAll other styles available at https://github.com/isagalaev/highlight.js/tree/main/src/styles\n\n\nExample template\n----------------\n\n   .. code:: Django\n\n    {% load highlightjs %}\n    <html>\n    <head>\n      <link href=\"{% highlightjs_css_url %}\" rel='stylesheet' type='text/css'>\n    </head>\n    <body>\n        {# Highlight Syntax using Highlightjs #}\n\n        {% highlightjs_this code_to_highlight %}\n        {% highlightjs_this code_to_highlight 'python' %}\n\n        {% highlightjs_javascript jquery=1 %}\n    </body>\n    </html>\n\n\nRequirements\n------------\n\n- Python 3.8, 3.9, 3.10 or 3.11\n- Django >= 3\n\nContributions and pull requests for other Django and Python versions are welcome.\n\n\nBugs and requests\n-----------------\n\nIf you have found a bug or if you have a request for additional functionality, please use the issue tracker on GitHub.\n\nhttps://github.com/mounirmesselmeni/django-highlightjs/issues\n\n\nLicense\n-------\n\nYou can use this under MIT See `LICENSE\n<LICENSE>`_ file for details.\n\n\nAuthor\n------\n\nMy name is Mounir Messelmeni, you can reach me at messelmeni.mounir@gmail.com .\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Django app to easyily integrate highlight.js syntax highlighter.",
    "version": "0.2.8",
    "split_keywords": [
        "django",
        "highlightjs",
        "syntax",
        "highlighter",
        "syntax highlighter",
        "highlight.js"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6c248b97d9aa3aca4004781b7966a9c7a931c127129fd7fa4c8d18851416db4a",
                "md5": "f28f71fb6c0f54eb739c621dd79f949b",
                "sha256": "4a4e91f5d0d4152b36bab79a78c91be782fd1f4589bc48d4009f22c9d5258442"
            },
            "downloads": -1,
            "filename": "django_highlightjs-0.2.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f28f71fb6c0f54eb739c621dd79f949b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 5981,
            "upload_time": "2023-02-05T21:53:44",
            "upload_time_iso_8601": "2023-02-05T21:53:44.555631Z",
            "url": "https://files.pythonhosted.org/packages/6c/24/8b97d9aa3aca4004781b7966a9c7a931c127129fd7fa4c8d18851416db4a/django_highlightjs-0.2.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7b1992780694ca723b5e06690678355369685b3e588f228dec5d6b92c610783e",
                "md5": "1cff9f22679bb209fe84d4ebd10d85c1",
                "sha256": "a5e177f710b0be718121fec72da034ea00663970291b84e92c62bd9dac31e373"
            },
            "downloads": -1,
            "filename": "django_highlightjs-0.2.8.tar.gz",
            "has_sig": false,
            "md5_digest": "1cff9f22679bb209fe84d4ebd10d85c1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 5377,
            "upload_time": "2023-02-05T21:53:45",
            "upload_time_iso_8601": "2023-02-05T21:53:45.716006Z",
            "url": "https://files.pythonhosted.org/packages/7b/19/92780694ca723b5e06690678355369685b3e588f228dec5d6b92c610783e/django_highlightjs-0.2.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-02-05 21:53:45",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "mounirmesselmeni",
    "github_project": "django-highlightjs",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "django-highlightjs"
}
        
Elapsed time: 0.06230s