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

Consider: Fix "plain" and "text" to come in line with "plaintext" #2363

Closed
joshgoebel opened this issue Jan 24, 2020 · 3 comments
Closed

Consider: Fix "plain" and "text" to come in line with "plaintext" #2363

joshgoebel opened this issue Jan 24, 2020 · 3 comments
Labels

Comments

@joshgoebel
Copy link
Member

Currently the noHighlightRe regex is:

  var noHighlightRe    = /^(no-?highlight|plain|text)$/i,

This means "plain" or "text" will result in skipping a block COMPLETELY, not applying ANY styling, not even the default "hljs" (codeblock) fg/bg styling. We now also have "plaintext"... which applies no code-level styling BUT will still result in a HLJS styled code block. IE, it's highlighted, but as "plaintext" vs not being highlighted at all.

To make this clearer I'd like to change the regex to match only "no highlight" or "no-highlight". plain will simply disappear and text could move to become an alias for plaintext.

Since this could be (in some ways) considered a breaking change I'd like to include it in version 10 and also make the regex configurable... that way anyone desiring the "old" behavior could achieve it by modifying the regex - and since that's evaluated first, boom they get the old behavior.

I think this would simplify things and remove some ambiguity. I've wanted to do this for a while but this issue prompted me to post: #2360

@egor-rogov Thoughts?

@egor-rogov
Copy link
Collaborator

I agree that this matter is very confusing. V10 looks like a right moment to change things, so I'm OK with it.
Maybe plain should also become an alias for plaintext, to be more consistent in a way.

@joshgoebel
Copy link
Member Author

If you INSIST I wouldn't argue, but to me "plain" doesn't really have a lot of meaning on it's own separate from "text"... so I'd wait and see if it proves to be necessary rather than add it preemptively.

@egor-rogov
Copy link
Collaborator

I have no strong opinion on that. Let it be plaintext and text then.

joshgoebel added a commit to joshgoebel/highlight.js that referenced this issue Jan 31, 2020
- Now only `no-highlight` and `nohighlight` skip a block entirely
- `plain` will do nothing
- `text` is now an alias for `plaintext`

Closes highlightjs#2363.
taufik-nurrohman pushed a commit to taufik-nurrohman/highlight.js that referenced this issue Feb 18, 2020
* (chore) make `noHighlightRe` and `languagePrefixRe` configurable (languageDetectRe now)
* (chore) simply 'nohighlight' regex

- Now only `no-highlight` and `nohighlight` skip a block entirely
- `plain` will do nothing
- `text` is now an alias for `plaintext`

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

No branches or pull requests

2 participants