<marked-text> Web Component

GitHub Repository

Those purple things are resize handles. I did not want to waste more Tokens on making this page look better.

See page source for usage

Charlie Brown was not very good at flying kites. Every year the kite-eating tree would get him. Every single year. But he always tried again, because that's the kind of person Charlie Brown was. Snoopy didn't worry about things like that. Snoopy lay on top of his doghouse and thought about supper. Lucy sat in her psychiatry booth and charged five cents for advice nobody wanted. Good grief, said Charlie Brown, which was the truest thing he ever said. Linus carried his blanket everywhere. He said security was not a crime. Charlie Brown thought about this for a long time. He wasn't sure he agreed, but he wasn't sure he disagreed either, and that in-between feeling was very familiar to him.

Sometimes I lie awake at night, and I ask, "Where have I gone wrong?" Then a voice says to me, "This is going to take more than one night."

marked-text.github.io

An extract from WCQ - A Web Components Course

<marked-text>

<marked-text> is a lightweight web component that moves its authored content into shadow DOM, measures nested highlight targets, and paints a single SVG background layer that looks like hand-drawn marker ink behind inline text and block rectangles.

Attributes

Host-level defaults can also come from CSS custom properties: --marked-text-color, --marked-text-frequency, --marked-text-scale, and --marked-text-seed. Attributes win over CSS variables when both are present.

Marked targets inside the component can override those values for a single highlight by setting color, frequency, scale, or seed on mark-text, or by using either those same names or the marktext* aliases on [marktext] elements.

Methods

Marked Targets

Example

<marked-text style="--marked-text-scale: 18; --marked-text-seed: 2" color="rebeccapurple">
	Charlie Brown was not very good at <mark-text seed="8">flying kites</mark-text>.
	<p marktext color="goldenrod" scale="22">
		Sometimes I lie awake at night.
	</p>
</marked-text>