Skip to content
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

Syntax Highlighting Breaks With _ #14

Open
tajmone opened this issue Aug 14, 2018 · 2 comments
Open

Syntax Highlighting Breaks With _ #14

tajmone opened this issue Aug 14, 2018 · 2 comments

Comments

@tajmone
Copy link

tajmone commented Aug 14, 2018

I've encountered problems with the following:

[NOTE]
================================================================================
You might want to output “$400” but “$4” will be interpreted as the indefinite form of the fourth parameter, as described below. So you need to use the ‘_’ to make that happen (“$_400”).
================================================================================

Where the _ in ‘_’ starts a never-ending italic styling in the highlighting, breaking the syntax highlighter from there onward.

(this issue might be related to Issue #12)

I've tried various approaches to the problem (escapes, non-curly quotes, and even `_` etc.) but either it solved the problem in ST code preview but broke the intended output, or didn't solve the problem at all.

I'll try to have a look at the syntax file myself when I find some time, but right now I'm just opening an issue to report the problem.

Most likely, the syntax definition that handles italics needs some tweaking, as that underscore should not trigger an italic style.

Also, it seems to lack bail-out fallbback checks to handle malformed code — as a general rule, syntax definitions should account for partial or malformed code, the former to handle when the user momemntarily interrupts what he was coding, leaving behind some incomplete syntax, the latter to handle malformed documents. In both cases the syntax highlighter shouldn't break so badly as to compromise the rest of the document:

@alejandroschuler
Copy link

I'm having the same issue. Rather annoying!

@tajmone
Copy link
Author

tajmone commented Mar 28, 2019

@alejandroschuler, there are some forks of this repo where the issue has been solved. Unfortunately this repository doesn't seem active, and the other repos are not officially endorsed by package.io.

I was hoping that this project becomes active again and starts accepting PRs for similar fixes and, possibly, move to ST3 (who uses ST2 anymore?). The only reason I could see for keeping the old ST2 syntax would be if some projects rely on it for syntax highlighting (eg. GitHub Linguist), but even then ... you can keep in the same ST package both the old and new syntax and ST will simply pick the right one.

One major step to start setting right this package would be to add a test suite (I'm not sure if ST2 supports them, but ST3 does), so it would be possible to pinpoint all the syntax problems and keep track of any syntax breaking changes when attempting to fix them.

But again, none of this is worth the effort unless the project is alive and open to PRs. I don't like the idea of installing forked packages (there are already too many unofficial forks of this project, each with its own fixes). It would make much more sense to integrate improvements in the upstream project instead of seeing of proliferation of unofficial packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants