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

Add support for ignoring languages #85

Closed
wants to merge 4 commits into from
Closed

Conversation

icholy
Copy link

@icholy icholy commented Oct 12, 2016

Relates to #82

@icholy
Copy link
Author

icholy commented Oct 12, 2016

After using this for about 5 minutes I realized that what I actually want is to blacklist languages.

@icholy icholy changed the title Add support for blacklisting file extensions Add support for blacklisting languages Oct 12, 2016
@icholy icholy force-pushed the master branch 2 times, most recently from f51e325 to 60f4be4 Compare October 12, 2016 17:16
@icholy
Copy link
Author

icholy commented Oct 13, 2016

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: ''
Copy link
Owner

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.

Copy link
Author

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.

Copy link
Owner

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']
}

Copy link
Author

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']
}

Copy link
Owner

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.

Copy link
Author

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.

Copy link
Owner

@tsenart tsenart Oct 17, 2016

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.

@icholy
Copy link
Author

icholy commented Oct 17, 2016

I've renamed it from "blacklist" to "ignore".

@icholy icholy changed the title Add support for blacklisting languages Add support for ignoring languages Oct 17, 2016
@tsenart
Copy link
Owner

tsenart commented Oct 17, 2016

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).

@icholy
Copy link
Author

icholy commented Oct 17, 2016

@tsenart
Copy link
Owner

tsenart commented Oct 17, 2016

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.

@icholy
Copy link
Author

icholy commented Oct 18, 2016

Ok, I'll need to change/extend how options are handle.

@icholy icholy closed this Jun 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants