Skip to content

[tool] Notepad++ ERB-HTML Syntax Language Highlighting User Definition #17

@DanRathbun

Description

@DanRathbun

Notepad++ ERB (for HTML) User Defined Syntax Language Highlighting

I used the User defined language feature of NPP to create some color lexing when working with ERB HTML template files.

I use black background so it's based on that. I post it here so any others might find it useful as a starting point. It will save you the trouble of inputting all the various keywords and delimiters.
On the keywords panel, those for HTML are on the right, Ruby and ERB on the left.
(On the right, top .. down are: HTML elements, HTML global attributes, HTML element specific and other attributes, and lastly: events.)

userDefineLang_ERB-HTML.xml.txt

To use with Notepad++, remove the temporary ".txt" from the file name.
In NPP, open the Language > Define your language... dialog.
At the top is a "Import..." button. Browse to where the xml file is, and choose OK.
You should now have a "ERB-HTML" item at the bottom of the Language menu.
You can select this lexing for any file you wish. It may have "erb" set as a filename so you may see new erb files opened afterward matching the lexing.

Just a note of caution. The Define your own lexing feature does have bugs.

  1. Sometimes certain words of one type get shown in another types color.
  2. I noticed when using my "Markdown" definition that sometimes the NPP save button does not know that I've modified the file. So I have to do a "Save As..." and overwrite, instead of a plain "Save".

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions