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

how to Syntax Highlighter Python #242

Open
andyhebear opened this issue Oct 27, 2021 · 2 comments
Open

how to Syntax Highlighter Python #242

andyhebear opened this issue Oct 27, 2021 · 2 comments

Comments

@andyhebear
Copy link

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
Copy link

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
Copy link

ljnath commented Oct 26, 2023

@andyhebear , you can refer this PR #249 where I added support for Assembly Language

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

3 participants