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

Previewer plugins should be merged into one #913

Closed
LeaVerou opened this issue Mar 19, 2016 · 6 comments
Closed

Previewer plugins should be merged into one #913

LeaVerou opened this issue Mar 19, 2016 · 6 comments

Comments

@LeaVerou
Copy link
Member

CC @Golmote

Right now there are too many separate Previewer plugins. This is disruptive, both for people who want them, and for people who don't want them.
For the former, they need to check each one individually and if a new one is added, they do not get the update because it's a separate plugin. I think it's more common for people to want more than one previewer than for them to only want one.
For the latter, they have to scroll through a long list of previewers to find the plugins they actually need. It's a lot of visual clutter.
My proposal is: Merge them into one “CSS Previewers" plugin, with a way to turn certain previewers off globally. That way, you might even be able to reduce the amount of total code, as some of it will be shared across previewers. Thoughts?

@Golmote
Copy link
Contributor

Golmote commented Mar 20, 2016

Code is already shared across Previewers since they all require the Previewer: Base plugin.

I agree they could be merged, though. But we still don't have any global configuration for Prism, have we? What API do you imagine to turn off some previewers?

@LeaVerou
Copy link
Member Author

Awesome!
I would suggest using inheritable classes to opt-out, e.g. no-gradient-previewer on the element or an ancestor disables gradient previewers.

@LeaVerou
Copy link
Member Author

Any progress on this?

@Golmote
Copy link
Contributor

Golmote commented Dec 5, 2017

Hi @LeaVerou.
I was finally taking a closer look at this (it's almost done, actually), and now I have second thoughts...

The Previewer: Color plugin does preview colors in HTML bgcolor attributes, which is not CSS. Thus I'm worried about merging it into a CSS Previewers plugin.

While thinking about this, I realized it would be great to add a previewer for images. But those can appear both in CSS and HTML (and Markdown, and probably other components...). So the grouping of previewers by language looks less relevant in this case.

@LeaVerou
Copy link
Member Author

LeaVerou commented Dec 5, 2017

Yup, you're right (in fact, dabblet previewers also do both CSS and HTML).
I think the Previewer plugin should add all of them by default, in whatever languages are included, and support a configuration attribute (inherited) to only enable specific ones. E.g. `data-previewers="color length image".
What do you think?

@Golmote
Copy link
Contributor

Golmote commented Dec 7, 2017

Sounds good to me.

Golmote added a commit to Golmote/prism that referenced this issue Dec 7, 2017
…eviewer: Angle, Previewer: Color, Previewer: Easing, Previewer: Gradient and Previewer: Time. Fix PrismJS#913
Golmote added a commit to Golmote/prism that referenced this issue Dec 7, 2017
…eviewer: Angle, Previewer: Color, Previewer: Easing, Previewer: Gradient and Previewer: Time. Fix PrismJS#913
Golmote added a commit that referenced this issue Jan 16, 2018
…eviewer: Angle, Previewer: Color, Previewer: Easing, Previewer: Gradient and Previewer: Time. Fix #913 (#1244)
papandreou added a commit to papandreou/prism that referenced this issue Jan 29, 2018
* gh-pages: (326 commits)
  Add C++ platform-independent types (PrismJS#1271)
  Release 1.10.0
  Unescaped markup plugin: Make it work with any language (PrismJS#1265)
  Previewers: New plugin combining previous plugins Previewer: Base, Previewer: Angle, Previewer: Color, Previewer: Easing, Previewer: Gradient and Previewer: Time. Fix PrismJS#913 (PrismJS#1244)
  Add Elm (elm-lang.org) support (PrismJS#1174)
  IchigoJam: Remove unneeded escape
  Run gulp
  add Io syntax (PrismJS#1251)
  package.json: add attribute `style` (PrismJS#1256)
  Add the C++11 raw string feature to the cpp language
  IchigoJam: Make strings greedy
  BASIC: Make strings greedy
  Run gulp
  Add support for IchigoJam BASIC (PrismJS#1246)
  Add support for 6502 assembly (PrismJS#1245)
  fix for autoloader plugin
  Run gulp and reorder components alphabetically
  Xeora Language implementation (PrismJS#1239)
  upgrade autoloader
  Release 1.9.0
  ...
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

No branches or pull requests

2 participants