Skip to content

Operators for class directive #233

@yhatt

Description

@yhatt

For now, class directive is just meaning setAttribute('class', 'xxxxxx') so assign the specified value into the slide as is. The problem is removing inherited class unless re-assign the class manually.

When setting the whole of color scheme by class, it may lose the color if changed the layout in a part of slide via _class spot directive.

<!-- The example based on Marp Core -->

<!--
theme: gaia
class: invert
-->

# Invert color

---
<!-- _class: lead -->

# Invert color?

---

# Invert color

The second page has lost invert color.

Proposal

Marpit recognizes + and - prefix in each of class names, and manipulate inherited class based on the operator. Don't require to know the inherited class.

  • <!-- _class: +lead --> adds lead class into the inherited class.
  • <!-- _class: -invert --> removes invert class from the inherited class.

It works on local directives and spot directives.

By this change, the class name beginning from specific operators cannot use in Marpit. Beginning + and - are valid as HTML class but not common because + requires to escape character in CSS definition.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    Delayed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions