Attribute

Sometimes we would like to use an attribution of an item. It is enough to use the attr feature to ensure that.

HTML
<div class="parent">
  <a href="/about">About</div>
</div>
Config
{
    "link": {
        "selector": "a",
        "attr": "href"
    },
}

// or use this shortcut

{
    "link": "a @ href"
}
Output
{
    "link": "/about" 
}

Multiple Attributes

HTML
<div class="parent">
  <a href="https://google.com" rel="noreferrer">Google</div>
</div>
Config
{
    "link": {
        "selector": "a",
        "attr": ["href", "rel"]
    },
}

// or use this shortcut

{
    "link": "a @ href, rel"
}
Output
{
    "link": {
        "href": "https://google.com",
        "rel": "noreferrer"
    }
}

All Attributes

{
    "link": {
        "selector": "a",
        "attr": "$all"
    },
}

// or use this shortcut

{
    "link": "a @ $all"
}
Output
{
    "link": {
        "href": "https://google.com",
        "rel": "noreferrer"
    }
}j

Last updated