Element

Marpit element class.

Constructor

new Element(tag, attributesopt)

Create a Element instance.

Element instance has compatibility with a plain object that is consists by tag key and pairs of attribute names and values. A difference is whether object has been frozen.

import assert from 'assert'
import { Element } from 'marpit'

const obj = { tag: 'div', class: 'marpit' }
const elm = new Element('div', { class: 'marpit' })

// This assertion would pass.
assert.deepStrictEqual(obj, { ...elm })
Parameters:
NameTypeAttributesDefaultDescription
tagstring

Tag name

attributesObject<optional>
{}

Tag attributes