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

MongoDB syntax #2518

Merged
merged 5 commits into from
Aug 13, 2020
Merged

Conversation

airs0urce
Copy link
Contributor

I applied changes as we discussed here: #2502

And also I have one question. I see with default theme tokens "builtin" and "string" have same color which visually looks like parsing has been broken:

Screen Shot 2020-08-13 at 5 38 19 PM

In some themes "builtin" token has different color, not like "string" token, which looks good:
Screen Shot 2020-08-13 at 5 40 59 PM

Question is - is there any recommendations by making "builtin" looks different from string with default theme?
Sure, I could create another theme and use it, but if the pull request will be approved, for people who decides to use this syntax it will be working bad by default like in the first screenshot.

@airs0urce
Copy link
Contributor Author

Another way - I could name that token not "builtin", but something that has different color, but then meaning will be lost, which is bad too

@RunDevelopment
Copy link
Member

You could use an alias. If you define class-name as an alias, the builtin classes will be highlighted in the same color as function in the default theme and the color in Tomorrow Night will remain the same.

@airs0urce
Copy link
Contributor Author

@RunDevelopment
Thank you, I set "keyword" as alias:
alias: "keyword"

Didn't use "function" as generic JS function and mongodb function should be highlighted different.
Looks like everything is ready now.

Copy link
Member

@RunDevelopment RunDevelopment left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good @airs0urce!

A few minor nits and then we can merge this.

components/prism-mongodb.js Outdated Show resolved Hide resolved
components/prism-mongodb.js Outdated Show resolved Hide resolved
components/prism-mongodb.js Outdated Show resolved Hide resolved
components/prism-mongodb.js Outdated Show resolved Hide resolved
@airs0urce
Copy link
Contributor Author

@RunDevelopment yes, agree about everything, will make the changes.
But not sure about "url" and "ip". The goal of adding them is to be able to easy catch those entities inside long string, for example I have logs written in MongoDB, I have long stack traces there and it will help to parse logs by eyes more quick:

Screen Shot 2020-08-13 at 8 22 58 PM

If we highlight only full string containing URL or IP it will break the original idea of adding highlight because it's easy to catch URL or IP if it's fully inside string. So, if you think that false positives possible then I can just remove url and ip from the definition. Or I can change as you suggested, but right now not sure if it will be useful if it's done this way.

@RunDevelopment
Copy link
Member

I have logs written in MongoDB, I have long stack traces there and it will help to parse logs by eyes more quick

If that was the explicit intention, then it's ok to keep it as is.

@airs0urce
Copy link
Contributor Author

@RunDevelopment Yes, it was explicit. many developers use MongoDB for logging purpose, so it should help to parse strings by eyes.

@RunDevelopment RunDevelopment merged commit 004eaa7 into PrismJS:master Aug 13, 2020
@RunDevelopment
Copy link
Member

Thank you for contributing @airs0urce!

quentinvernot pushed a commit to TankerHQ/prismjs that referenced this pull request Sep 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants