innerHTML β GitHub Pages
Like the gist:// version,
the markup is edited as text in a plain <textarea> β
persisted with the ordinary of value rule below, no opt-in
needed for that part. The difference: this file lands at a real,
browsable path inside your repo (be-persistent-demo/markup.html),
not one file inside an opaque gist. The
unsanitizedInnerHTML-style handshake (dispatch
securitypolicyviolation, require
event.anythingGoes = true) still gates the separate
preview further down, which is the part that actually renders
your text as live HTML.
Plain of value β an ordinary be-persistent rule; a
<textarea>'s value is always text, so it never
needs unsanitizedInnerHTML. The field starts empty, so
nothing is written until you type and leave it. Typing fires
input on every keystroke; this rule uses
on focusout instead so one commit is made when you
leave the field, not one per key. Reload the page β the text comes
back from the repo.
This is the part that actually needs the opt-in.
#preview renders whatever is in the source field above
as live HTML via innerHTML β but only once it
dispatches securitypolicyviolation and its own
onsecuritypolicyviolation="event.anythingGoes = true"
handler agrees, the same handshake of unsanitizedInnerHTML
uses internally. Updates as you type, and once after a reload
restores the source from the repo.
Reading a public repo needs no token at all β get()
works the moment a scheme is registered. Point this at any real
file (defaults to this repo's own README, read straight off
bahrus/be-persistent).