LHTML+ lhtml-site

Links and images

LHTML
See link::https://scholartools.fr[ScholarTools] for more tools.
Result
HTML produced
See <a href="https://scholartools.fr">ScholarTools</a> for more tools.

The URL comes right after link::, the label between brackets. The label can hold bold, italic or inline code; without a label, the link shows its URL:

A link without a label, a label in bold
LHTML
link::https://example.org
or link::https://example.org[a **bold** label]
Result
HTML produced
<a href="https://example.org">https://example.org</a>
or <a href="https://example.org">a <strong>bold</strong> label</a>

A class goes in parentheses after the URL: link::page.html(.nav)[Back to home]. A link to a part of the page is link::#exercise[...] (see Classes and ids).

Images

An image, its width in the style
LHTML
img::https://scholartools.fr/favicon.svg[width:64px;]
Result
HTML produced
<img style="width:64px;" src="https://scholartools.fr/favicon.svg" alt="https://scholartools.fr/favicon.svg">

A relative path, as img::assets/photo.jpg, starts from the page. The alt text, read by screen readers and shown when the image is missing, is by default the path of the image. Give a better one as an attribute:

An image and its alt text
LHTML
img::https://scholartools.fr/favicon.svg[width:64px;]{alt="The logo of ScholarTools"}
Result
HTML produced
<img style="width:64px;" alt="The logo of ScholarTools" src="https://scholartools.fr/favicon.svg">

Put the image in the label of the link: a click on the image opens the page.

A clickable image
LHTML
link::https://scholartools.fr[img::https://scholartools.fr/favicon.svg[width:48px;]{alt="ScholarTools"}]
Result
HTML produced
<a href="https://scholartools.fr"><img style="width:48px;" alt="ScholarTools" src="https://scholartools.fr/favicon.svg"></a>

Videos

video:: shows a video without its buttons: add the attribute controls to play and pause it.

A video with its buttons
LHTML
video::https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4[width:320px;]{controls}
Result
HTML produced
<video controls style="width:320px;">
	<source src="https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4" type="video/mp4">
	 Cannot play video https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4
</video>

A poster, the image shown before the video starts, is an attribute too: video::clip.mp4{controls poster="clip.jpg"}. LHTML does not look for one: write it.

videoplay plays by itself, in a loop and without sound: the form for an animation in a slide.

An animation
LHTML
videoplay::https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4[width:320px;]
Result
HTML produced
<video autoplay loop muted playsinline style="width:320px;">
	<source src="https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4" type="video/mp4">
	 Cannot play video https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4
</video>

Not every browser reads every format. lhtml-site can convert the videos: set cache_video_directory: in configure.yaml, and the build makes the variants of the videos in the assets/ of each page, each one added as a <source> of its video. lhtml-site doctor says whether the tools it needs are installed.

Next: Code. All the rules: Syntax reference.

Built with lhtml-site, the docs theme. Part of ScholarTools.