marp-team / marpit

The skinny framework for creating slide deck from Markdown

Home Page:https://marpit.marp.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deprecate harmful shorthand for setting colors

yhatt opened this issue · comments

Marpit's ![]() shorthand syntaxes for settings colors can set the text color and background color for the current slide in less characters than the scoped local directive.

But that is just all! Actually they are rarely used, and harmful in the point of view from Markdown compatibility.

  • ![]() is an image syntax in CommonMark, not the color syntax. We are making efforts to keep compatible Marpit syntax with Markdown documents, but the common Markdown parser will rest the broken <img> element to the output of rendering.
  • We already have provided an alternative way to set colors. It means there are no feature regressions even if removed the shorthand syntax.
    • ![](red) ➡️ <!-- _color: red --> / <style scoped>:root { color: red; }</style>
    • ![bg](red) ➡️ <!-- _backgroundColor: red -->/<style scoped>:root { background-color: red; }</style>.
  • To make the image syntax parsable as color setting, we have to provide the parser for CSS color. Today, both of CSS Color Module Level 4 and 5 are evolving to support a lot of color spaces and color conversion functions. Using declarative directive syntax is obviously smart rather than enhancing Marpit-specific color parser.

We will progress with deprecation and removal of shorthand syntax for setting text and background color.

  • Next minor of Marpit
    • Emit warnings to the console if used shorthand syntax for setting colors (helpful to Marp CLI)
    • Marp for VS Code: Add new diagnostic to warn deprecation and provide auto fix to replace into the local directive / scoped style
  • Next major of Marpit
    • Remove shorthand syntax for setting colors from Marpit