Adds pygments library for html formatting of the plain text result preview#21
Adds pygments library for html formatting of the plain text result preview#21dubrousky wants to merge 4 commits into
Conversation
|
Hello. I have to say: a cracking idea! I briefly tested the patch (had to change an There is a slight problem however: I had a quick look at pygments' docs and I'd propose using |
|
Hi, as for the way to recognize the source file language - if we knew the full path to the file, we might use |
|
You can get the full path from doc.url (the original doc, not the tdoc which holds the extracted text). You could also conceivably make use of doc.mimetype. This can have 2 origins:
So there is a slight risk of unstability and system/version dependances with the mime type, and maybe you're better off using the extension if there is one. |
…n filename, adds configuration and defaults for preview mode.
Pygments is a python source code highlighter http://pygments.org/docs/ . The idea is to use highlighting tools when previewing the plain text search results. The changes added perform the guess on the source code language based on the previewed contents and if match found - highlight the preview as html page with formattng and line numbers. If there is no pygments installed in the system the code falls back to the plain text.