Attributes Extension

Vladimir Schneider edited this page Mar 15, 2018 · 2 revisions

Converts attributes {...} syntax set HTML attributes for immediately preceding sibling element during HTML rendering.

  • Simplified rules with No plain text attributes selected

    Applied to the preceding element, if that element is plain text then attributes are applied to the parent element of the text.

    If the attributes element is the first element of a paragraph then the attributes will be applied to the paragraph's parent element. Effectively putting attributes element first in a paragraph allows you to set the attributes of list items, block quotes or other paragraph containers.

  • Default Extended Behavior, No plain text attributes not selected:

    If an attribute element is spaced from the previous plain text element some text {attributes} then attributes are for the parent of the text. If they are attached to the text element some text{attributes} then they are assigned to the immediately preceding plain text span.

    Within an inline element same rules apply: **bold text {attr}** are for the strong emphasis span, while **bold text{attr}** will wrap the text between the strong emphasis tags, in a span with given attributes.

    If a plain text span is interrupted by an HTML comment then it is considered as two separate plain text spans. ie. some <!---->text{attr} will result in some <!----><span attr>text</span> rendering.

The attributes is a space separated list of attribute syntax of one of the following:

  • name=value
  • name='value'
  • name="value"
  • #id
  • .class

Attribute which starts with # such as #id-string is equivalent to id="id-string" and .class-name are equivalent to class="class-name"

NOTE: Handling of multiple value assignment for attributes depends on its name:

  • class values are accumulated as a space () separated list.
  • style values are accumulated as a semicolon (;) separated list.
  • all others override any previous values of the same name.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.