Skip to main content

Python Source Code Types For Inline Syntax Highlighting

Project description

Python Source Code Types For Inline Syntax Highlighting

Type annotations for various languages, when applied to multi line strings will syntax highlighting with the python-inline-source VS Code plugin.

Supports html, css, javascript, typescript, sql, graphql, multiple css extension languages, template languages and many more, see below for a full list.

Uses typing.Annotated to annotate the str type with the language used. You can use typing.get_type_hints at runtime to determine the language that a string has been annotated with.

Installation

pip install sourcetypes

Example

Example

Usage

Use a type decoration named for language that you are using:

import sourcetypes

my_html_string: sourcetypes.html = """
  <h1>Some HTML</h1>
"""

or:

from sourcetypes import html

my_html_string: html = """
  <h1>Some HTML</h1>
"""

Supported Languages

  • markdown (aliased as md)
  • html
  • django_html (aliased as django)
  • django_txt
  • jinja
  • jinja_html
  • css (aliased as style, and styles)
  • scss
  • less
  • sass
  • stylus
  • javascript (aliased as js)
  • jsx (aliased as javascriptreact, and react)
  • typescript (aliased as ts)
  • tsx (aliased as typescriptreact)
  • coffeescript (aliased as coffee)
  • sql
  • json
  • yaml
  • graphql
  • xml
  • python

Release Notes

[0.0.1] - 2022-03-11

  • Alpha release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sourcetypes-0.0.2.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sourcetypes-0.0.2-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file sourcetypes-0.0.2.tar.gz.

File metadata

  • Download URL: sourcetypes-0.0.2.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.2

File hashes

Hashes for sourcetypes-0.0.2.tar.gz
Algorithm Hash digest
SHA256 515f46c93ec2fe3a294cfb955559ab90170a6db04ad8f43688d1bbc365127592
MD5 a26d026865af03c5c7207d7806396610
BLAKE2b-256 0756a02009cf6b990513e8442b20ed38819c8b2032009a37fae434bb511163fd

See more details on using hashes here.

File details

Details for the file sourcetypes-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: sourcetypes-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 3.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.2

File hashes

Hashes for sourcetypes-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bc9cab0a705046100bdb518f1a547949853a0accb11c40b9bb69c5bdd30c1a7f
MD5 10a6f4da9882bb3291c85164d716673e
BLAKE2b-256 6a491593db5f9e229513fe8b3fa0ce5a6e4669fd39960db8d647d9a359e003ff

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page