Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/johnowhitaker/syninpy
https://github.com/johnowhitaker/syninpy
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/johnowhitaker/syninpy
- Owner: johnowhitaker
- License: other
- Created: 2024-08-01T19:03:21.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-08-01T19:33:58.000Z (5 months ago)
- Last Synced: 2024-08-01T21:36:17.810Z (5 months ago)
- Language: TypeScript
- Size: 209 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# syninpy README
Hackily adding syntax highlighting to JS snippets in python
Extension page: https://marketplace.visualstudio.com/items?itemName=JohnoWhitaker.syninpy
Warning: experimental, not tested much, use at your own risk :)
## Usage
Include your snippets in the code like this to get syntax highlighting:
```python
def python_function():
print("Hello World")#js
script = """
document.addEventListener('DOMContentLoaded', function() {
var accordionItems = document.querySelectorAll('.accordion-item');accordionItems.forEach(function(item) {
item.addEventListener('shown.bs.collapse', function() {
var headerElement = this.querySelector('.accordion-header');
var yOffset = -10; // Adjust this value to fine-tune the scroll position
var y = headerElement.getBoundingClientRect().top + window.pageYOffset + yOffset;
window.scrollTo({top: y, behavior: 'smooth'});
});
});
});
"""def another_python_function():
print("Hello World")```
You can also end with #end-js. Note it skips the line immediately after the #js tag.
`# js` and `# end-js` now also work, for those with linters.
Screenshot:
![Screenshot](https://raw.githubusercontent.com/JohnoWhitaker/syninpy/main/screenshot.png)