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

Deprecate harmful shorthand for setting colors #331

Closed
yhatt opened this issue May 13, 2022 · 0 comments · Fixed by #379
Closed

Deprecate harmful shorthand for setting colors #331

yhatt opened this issue May 13, 2022 · 0 comments · Fixed by #379

Comments

@yhatt
Copy link
Member

yhatt commented May 13, 2022

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant