-
Notifications
You must be signed in to change notification settings - Fork 68
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
Add support for ignoring languages #85
Conversation
After using this for about 5 minutes I realized that what I actually want is to blacklist languages. |
f51e325
to
60f4be4
Compare
I need this so I can use json-formatter for json files. |
@@ -77,7 +77,8 @@ | |||
theme: 'sunburst', | |||
font: 'Inconsolata', | |||
fontSize: 'medium', | |||
lineNumbers: true | |||
lineNumbers: true, | |||
languageBlacklist: '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd generalise this by making the value a regular expression that's matched against the URL. This way we can not only skip specific languages but whole domains. What do you think? I'd call it, ignore
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that the language is often determined by the content-type. In those cases, url filtering isn't enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you're right. Without wanting to overly complicate things, for this PR in particular, but allowing for domain blacklisting to gracefully extend this work, what would you think of:
blacklists: {
languages: ['javascript', 'ruby'],
domains: ['github.com']
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no problems with that. Did you want to rename it to ignore
?
ignore: {
languages: ['javascript', 'ruby'],
domains: ['github.com']
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignore sounds better IMO, but I leave that up to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the current way options are handled, I'm not sure how to create that nested structure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, it doesn't fit too well with the current code structure. I'm OK with splitting these options then. ignoreLanguages
and ignoreDomains
.
I've renamed it from "blacklist" to "ignore". |
OK, I was testing this locally and I'm not super happy with the textarea interface to configure this. The user wouldn't know what to type: Javascript, JavaScript, JS, Js, js. I think we should either create checkboxes for each language (easy) or enable auto-completion of the language names (harder). |
Yeah, that's the second option, but I'd be really happy with the checkboxes sorted alphabetically. Most users will only check a few I think, so it's not a hard process. Besides, I'm not sure I want to introduce all those dependencies. |
Ok, I'll need to change/extend how options are handle. |
Relates to #82