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

Support setting background color by markdown image syntax #113

Merged
merged 8 commits into from
Dec 26, 2018

Conversation

yhatt
Copy link
Member

@yhatt yhatt commented Dec 25, 2018

Support setting background color by markdown image syntax ![bg](#abc123).

If an image URL is parsable as CSS color, Marpit would assign it as backgroundColor directive, not backgroundImage. This behavior has no difference between in regular mode and inline SVG mode. We're using color-string package to resolve CSS color (and Marpit can also parse currentColor additionally).

For example, below 2 markdown files have the same output.

![](red)

# Hello
<!-- _backgroundColor: red -->

# Hello

This PR includes the refactor of a bit bloated Marpit background image plugin to be modularize into multiple plugins. It resolves #92 and yhatt/marp#252.

ToDo

  • Add docs
  • Add more test cases
    • Regular mode
    • Inline SVG mode

@yhatt yhatt changed the title [WIP] Support setting background color by markdown image syntax Support setting background color by markdown image syntax Dec 26, 2018
@yhatt yhatt merged commit 43a1ccc into master Dec 26, 2018
@yhatt yhatt deleted the color-keyword branch December 26, 2018 09:06
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.

Set background color by markdown image syntax
1 participant