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

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

Merged
merged 1 commit into from
Mar 16, 2024

Conversation

platima
Copy link

@platima platima commented Mar 13, 2024

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 ctapmex merged commit d7f4b2a into colorer:master Mar 16, 2024
1 check passed
@ctapmex
Copy link
Member

ctapmex commented Mar 16, 2024

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

@platima
Copy link
Author

platima commented Mar 17, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants