colorer / Colorer-schemes

Syntax and color schemes for colorer library
31 stars 25 forks source link

Added firstline regex for HTML, CSS, SQL and JSON #146

Closed platima closed 8 months ago

platima commented 8 months ago

Added regex for JSON, HTML, CSS and SQL. Tested a fair bit, eg with similar languages like generic XML to hopefully avoid collisions. Also set some weights which I think may be right. Currently in-use on tohtml.com

CSS: This pattern aims to catch lines starting with optional whitespace, followed by a selector (class ., ID #, or element/tag name), and then an opening brace {.

JSON: This pattern matches a JSON object's start, specifically looking for a key defined by double quotes and followed by a colon.

SQL: These patterns aim to match common SQL keywords, statements and comments .

HTML: These patterns identify HTML through common opening tags, else lines that start with HTML-specific tags.

ctapmex commented 8 months ago

I have removed the changes for html. They break the tests. I'm not ready to offer another option yet.

platima commented 8 months ago

I have removed the changes for html. They break the tests. I'm not ready to offer another option yet.

Ah okay what tests did they break? I can re-work the regex to make it more specific or acceptible