Skip to content

Instantly share code, notes, and snippets.

@noamr
Forked from foolip/1-anonymous-markers.html
Last active January 16, 2026 13:48
Show Gist options
  • Select an option

  • Save noamr/b50b56ca75dfdddfb243507078758618 to your computer and use it in GitHub Desktop.

Select an option

Save noamr/b50b56ca75dfdddfb243507078758618 to your computer and use it in GitHub Desktop.
<!-- replace all (no markers) -->
<div sink="container">
Loading...
</div>
<template for="container">
<p>result 1</p>
<p>result 2</p>
</template>
<!-- single marker - replace that marker -->
<ul sink="list">
<li>first item</li>
<!marker sink="list">
<li>last item</li>
</ul>
<template for="list">
<li>middle item</li>
</template>
<!-- replace between two markers (inclusive) -->
<section sink="section">
<header>header stuff</header>
<!marker sink="section">
Placeholder content
<!marker sink="section">
<footer>footer stuff</footer>
</section>
<template for="section">
<p>Real content</p>
</template>
<!-- three markers: replace the range containing all the marker matching the ref. -->
<section sink="section">
<header>header things</header>
<!marker sink="section">
Placeholder content
<!marker sink="section">
More placeholder?
<!marker sink="section">
<footer>last thing</footer>
</section>
<template for="section">
<p>Real content</p>
</template>
<!-- replace then append multiple times -->
<!-- We re-insert a marker for appending -->
<div sink="search-results">
Searching...
</div>
<template for="search-results">
<p>One result</p>
<!marker sink="search-results">
</template>
<template for="search-results">
<p>Another result</p>
<!marker sink="search-results">
</template>
<!-- advanced: multiple separate markers -->
<div sink="one two">
<!marker sink="one">
<hr>
<!marker sink="two">
</div>
<template for="one">
<p>First thing</p>
</template>
<template for="two">
<p>Second thing</p>
</template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment