Skip to content

Highlight code snippets embedded in strings or comments

Notifications You must be signed in to change notification settings

cpitclaudel/indirect-font-lock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Indirect font-lock

This is a small utility library for highlighting code embedded in comments or strings. Examples could include doctests in Python, examples in JavaDoc, code snippets in LaTeX or reStructuredText, etc. This library doesn't implement any of that, though: it just provides the plumbing to do so.

Here's how it could look in practice:

indirect-font-lock.png

And here's how you'd achieve that:

(font-lock-add-keywords nil
  '(("^#*\\s-*\\(>>>\\|\\.\\.\\.\\) ?\\( *\\(.+\\)$\\)"
     (0 (indirect-font-lock-highlighter 3 'python-mode)))))

About

Highlight code snippets embedded in strings or comments

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published