-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PR: Add Markdown syntax highlighter. #4352
Conversation
Thanks a lot for this @rlaverde!! Could you post a screenshot of a Markdown file with code blocks? Thanks! |
I think this is kinda ready, Although I've run into an issue: there isn't and standard way (maybe an api) to extend BaseSH; different languages need different keys, and styles for that keys i.e.:
I'd to do an workaround to add new keys-styles, but that's styles aren't cc @goanpeca |
if key == "code": | ||
# Change to code | ||
self.setFormat(0, len(text), self.formats["code"]) | ||
self.setCurrentBlockState(self.CODE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we use here the highlighter corresponding to the code language?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a nice idea, I'm not sure, I'll try to do it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ccordoba12 its a nice idea indeed, but I think we should postpone that to 4.0 as it would probably require a better re-estructuring of syntax highlighters.
I think for what we need this is already a good step
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem.
I think Markdown is a special case, so let's leave things as they are for now. In your screenshot, the last line is not highlighted correctly: |
I don't think so, It'll happen with other markup languages (html, rest), or config files (ini, yaml), also with some frameworks (jinja), also with other programming languages that aren't python-like.
yes, but maybe we could improve this for spyder4 In your screenshot, the last line is not highlighted correctly: but is in green when it should be in black. Thanks, I didn't notice, I fixed the regex 😄 |
We already have support for all those formats (except Jinja). But the main idea is that Markdown is a special case because there's no Pygments support for it.
Maybe for 4.1, for now let's focus on getting this merged ;-) Please merge with 3.x to fix CircleCI, and then I'll merge. |
This is ready (and I haven't noticed it, sorry :-). Merging. |
As a part of the development of https://github.com/spyder-ide/spyder-reports is necessary to add markdown support to the editor