PavelTorgashov / FastColoredTextBox

Fast Colored TextBox for Syntax Highlighting. The text editor component for .NET.
Other
1.23k stars 465 forks source link

how to Syntax Highlighter Python #242

Open andyhebear opened 3 years ago

andyhebear commented 3 years ago

how to Syntax Highlighter Phyton like this: import sys import os import mimetypes from wsgiref import simple_server, util

def app(environ, respond):

fn = os.path.join(path, environ['PATH_INFO'][1:])
if '.' not in fn.split(os.path.sep)[-1]:
    fn = os.path.join(fn, 'index.html')
type = mimetypes.guess_type(fn)[0]

if os.path.exists(fn):
    respond('200 OK', [('Content-Type', type)])
    return util.FileWrapper(open(fn, "rb"))
else:
    respond('404 Not Found', [('Content-Type', 'text/plain')])
    return [b'not found']
Hexman768 commented 1 year ago

You probably want to find some other examples of people having created their own rules for a custom language implementation. This editor does allow for custom language highlighting based on xml I think it is, as well as programmatically. I will link an example of how I once did it programmatically. This is the method I used to create rules for Windows Batch files syntax highlighting.

ljnath commented 1 year ago

@andyhebear , you can refer this PR https://github.com/PavelTorgashov/FastColoredTextBox/pull/249 where I added support for Assembly Language