Skip to content

Disable text interpolation for target block #66

@SerafimArts

Description

@SerafimArts

Im does not found this option in docs. Is this exists?

Like:

<div class="{{ works }}">
    <code data-bind="punches: false">
        Some {{ example with }} {{ raw }} text
    </code>
</div>

UPD Fastfix (slow and have bugs):

for (let node of document.body.querySelectorAll('[data-punches="false"]')) {
    node.innerHTML = node.innerHTML
       .replace(/(\{\{|\}\})/g, p => `{{"${p}"}}`)
}

UPD Fastfix No2 (does not work):

for (let node of document.body.querySelectorAll('[data-punches="false"]')) {
    node.innerHTML = node.innerHTML
        .replace(/\{\{/g, '&#123; &#123;')
        .replace(/\}\}/g, '&#125; &#125;');
}

UPD Fastfix No3 (works but has side effects)

for (let node of document.body.querySelectorAll('[data-punches="false"]')) {
    node.innerHTML = node.innerHTML
        .replace(/\{\{([\s\S]*?)\}\}/g, (i, j) => `&#123;&#8203;&#123;${j}&#125;&#8203;&#125;`)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions