Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
The original Python Inline Source by Sam Willis is no longer maintained. Please raise your issues and questions in jurooravec/python-inline-source-2.
The PyPI package and VSCode extension have also been migrated:
- PyPI: sourcetypes -> sourcetypes2
- VSCode: samwillis.python-inline-source -> jurooravec.python-inline-source-2
This fork is based on v0.0.4.
Type annotations for various languages, when applied to multi line strings will syntax
highlighting with the python-inline-source-2
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.
On Python versions prior to 3.9 uses typing_extensions to support Annotated
types.
pip install sourcetypes2
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>
"""
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
FAQs
Python Source Code Types For Inline Syntax Highlighting
We found that sourcetypes2 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.