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 python-sourcetypes
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 asmd
)html
django_html
(aliased asdjango
)django_txt
jinja
jinja_html
css
(aliased asstyle
, andstyles
)scss
less
sass
stylus
javascript
(aliased asjs
)jsx
(aliased asjavascriptreact
, andreact
)typescript
(aliased asts
)tsx
(aliased astypescriptreact
)coffeescript
(aliased ascoffee
)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.1.tar.gz
(2.9 kB
view hashes)
Built Distribution
Close
Hashes for sourcetypes-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29cf1b6a21780af1affd2861ae60456fabcf8d7cc0850f269dd5c8588e3de921 |
|
MD5 | c092c8a81486b58fd354e705fa69ca3e |
|
BLAKE2b-256 | 5fd35d443f507ae47f9543f854811f529b7c18bf284d970d4bbb6c193fadc62f |