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

Add sweep plugin #8

Merged
merged 9 commits into from
Apr 28, 2018
Merged

Add sweep plugin #8

merged 9 commits into from
Apr 28, 2018

Conversation

yhatt
Copy link
Member

@yhatt yhatt commented Apr 25, 2018

Marpit sweep plugin will hide blank paragraph tokens. Normally the background image syntax ![bg]() would be written as paragraph of Markdown. The following example is the result of rendering without a background syntax support.

![bg](https://example.com/bg.jpg)
<p><img src="https://example.com/bg.jpg" alt="bg" /></p>

The same case would find in Marpit directives. Marpit can parse HTML comment without html: true markdown option, so it would be wrapped by paragraph when markdown-it has disabled html option.

<!-- theme: default -->
<p>&lt;!-- theme: default --&gt;</p>

When the multiple HTML comments or background images in a paragraph are rendered, the whitespace and breaks between tokens would keep as the content of paragraph.

![bg](https://example.com/bg1.jpg)
![bg](https://example.com/bg2.jpg)
<p>  <- softbreak between images
</p>

We don't expect to be rendered the paragraph with the blank content. Marpit sweep plugin provides a common logic to hide the paragraph and its content.

ToDo

  • Add test of Marpit sweep plugin
  • Remove the logic removing blank paragraph from Marpit comment plugin
  • Update background image plugin to be able to sweep
    • Split and add image parser plugin

EDIT: Background image plugin that is implemented in #5 can not apply sweep logic because of context of the order of plugin. We updated background image plugin to be better.

@yhatt yhatt merged commit e4bf1d8 into master Apr 28, 2018
@yhatt yhatt deleted the sweep-logic branch April 28, 2018 18:17
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.

1 participant