n1k0 / SublimeHighlight

A humble SublimeText package for exporting highlighted code as RTF or HTML

Home Page:https://github.com/n1k0/SublimeHighlight

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't copy to clipboard

Hsn723 opened this issue · comments

ST3, W10 1607. Removed and reinstalled SublimeHighlight multiple times, both from master and python3 tree.

Traceback (most recent call last):
  File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 812, in run_
    return self.run(edit, **args)
  File "C:\Users\natsu\AppData\Roaming\Sublime Text 3\Packages\SublimeHighlight\SublimeHighlight.py", line 117, in run
    pygmented = self.highlight(output_type, full)
  File "C:\Users\natsu\AppData\Roaming\Sublime Text 3\Packages\SublimeHighlight\SublimeHighlight.py", line 105, in highlight
    return pygments.highlight(self.code, self.get_lexer(),
  File "C:\Users\natsu\AppData\Roaming\Sublime Text 3\Packages\SublimeHighlight\SublimeHighlight.py", line 88, in get_lexer
    lexer = pygments.lexers.guess_lexer(code)
  File "C:\Users\natsu\AppData\Roaming\SUBLIM~1\Packages\pygments\all\pygments\lexers\__init__.py", line 252, in guess_lexer
    raise ClassNotFound('no lexer matching the text found')
pygments.util.ClassNotFound: no lexer matching the text found

same issue on Mac OS with latest Sublime and plugin

copy as RTF does not work when code is view with Java Syntax

Traceback (most recent call last):
File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 812, in run_
return self.run(edit, **args)
File "/Users/zcwang3/Library/Application Support/Sublime Text 3/Packages/Highlight/SublimeHighlight.py", line 117, in run
pygmented = self.highlight(output_type, full)
File "/Users/zcwang3/Library/Application Support/Sublime Text 3/Packages/Highlight/SublimeHighlight.py", line 105, in highlight
return pygments.highlight(self.code, self.get_lexer(),
File "/Users/zcwang3/Library/Application Support/Sublime Text 3/Packages/Highlight/SublimeHighlight.py", line 88, in get_lexer
lexer = pygments.lexers.guess_lexer(code)
File "/Users/zcwang3/Library/Application Support/Sublime Text 3/Packages/pygments/all/pygments/lexers/init.py", line 252, in guess_lexer
raise ClassNotFound('no lexer matching the text found')

Just a friendly reminder that this project is looking for a new maintainer :) see #78

😯

😯,so sad
do we have other plugin has similar functionality?

Not any I'm aware of but I didn't look very hard as I'm not using Sublime anymore.

got it. Thanks very much 👍

For anyone still having this issue, I took a look at it today and it might be a regex bug with the python3 branch. guess_lexer_from_syntax uses the regex re.match(r"Packages/.*/(.*?)\.tmLanguage$", syntax) (line 60) when it should be re.match(r"Packages/.*/(.*?)\.(?:tmLanguage|sublime-syntax)$", syntax) like on master. In fact that issue has already been fixed on master and the python3 branch hasn't been updated in a year. I don't know if the master branch is compatible with python3, but I'm closing this issue since it works for me now after editing that line.

"Copy as RTF" works after the fix and the format can be paste into microsoft word.
While when paste into Evernote, the color is missed...

Thanks