Comments (2)
Hi,
thanks for the explanation.
The
.multi
part is not checked for, as single-quoted docstrings are still technically valid docstrings in Python.
Oh... that's something I did not know until now, although I am using Python quite long. Well, then it explains what I saw. During some experiments with custom highlighting, also with your extension, searching for a solution that matches my needs, I simply injected a single-quoted string under my triple-quote docstring to test "scope escaping", not knowing that VSCode's grammar correctly maps it to the "docstrings" as highlighting does not differ (in my theme) from strings in assignments or other expressions.
So basically my mistake and your extension seems to work perfectly at this point. :D
Do you plan to add more syntaxes? Like inline monospaced literals with two back-ticks? Or will you keep just the support role-syntax?
And is it possible to customize the colors? Currently the detected roles are highlighted (in my theme) with the same color as my Python keywords like def
or return
. Would be nice to dim that by setting custom colors in your extension.
Edit:
Forget about the last two. :D Now I see your supported syntaxes and that you also inject the .sphinx
scope. That should make customization for me simple. Gonna try this.
So you can close this now. :D Sorry for bothering you. ;)
from python-sphinx-highlighter.
Hi, this extension injects its highlighting into string.quoted.docstring
scopes for the source.python
grammar, as you suggested. The .multi
part is not checked for, as single-quoted docstrings are still technically valid docstrings in Python.
I originally considered using existing reST highlighting for this injection, but decided against it as it tends to colour docstrings differently from other Python strings for many syntax themes. It also broke compatibility with mixed style projects that use Google or NumPy styles for arguments and parameters but still have Sphinx references for use with Napoleon in built docs.
IIRC it is possible for the selectors of the injected grammar to spill beyond its enclosing scope's if a RegEx attempts to lookahead past the end of its parent scope, but this extension does not use anything sufficiently greedy.
Could you share a minimal reproducible example for the highlighting escaping its docstring? Cheers.
from python-sphinx-highlighter.
Related Issues (12)
- Sphinx style docstring issues
- Support three-field tags HOT 1
- Support inline generic types
- support for multiple docstring formats HOT 2
- Google style docstring issues HOT 1
- Numpy style docstring issues HOT 1
- Make parameter highlighting rules more permissive HOT 4
- Do not allow whitespaces around inline formatting control characters HOT 1
- Documentation for how to use the extension is unclear HOT 2
- Differentiate between tag and valuie HOT 7
- Closing `:` is not reported as `punctuation.definition.interpreted.sphinx` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-sphinx-highlighter.