JSFiddle - React, Tailwind, and code Playground
HTML
<p id="p1">This is paragraph 1. </p>
<p id="p2">
This is paragraph 2.
</p>
<p id="p3">This is paragraph 3. It should contain paragraphs 1 and 2.
<script>transclude("p1")("p2")</script>
</p>
CSS
p {padding: 1em; border: 1px dotted blue;}
JavaScript
function transclude(elementId) {
var clone = document.getElementById(elementId).cloneNode(true),
placeholder;
clone.id = null;
document.write('<br id="__placeholder__">');
placeholder = document.getElementById('__placeholder__');
placeholder.parentNode.insertBefore(clone, placeholder);
placeholder.parentNode.removeChild(placeholder);
return transclude;
}