Fossil

Update of ”branch/markdown-tagrefs”
Login

Update of ”branch/markdown-tagrefs”

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview

Artifact ID: e45e9240c0aa3448552f68a4934e4553c4daaaf246d48518c397e63dbbf64015
Page Name:branch/markdown-tagrefs
Date: 2024-07-03 09:29:21
Original User: stephan
Mimetype:text/x-markdown
Parent: 071af69c2b5f0852f649e1836bbef4d60a253c9d56f1f6448afed0599a15ca94 (diff)
Next 5a0593111ecbdda6e19aa62146df03e3425754f2160f8384b08fb1adf1627052
Content

The purpose of the markdown-refs branch is to experiment with adding hashtag and @username support into the markdown parser.

In short, it attempts to recognize hashtags and @username references and wraps those tokens in SPAN elements with well-defined class name so that they can be identified by downstream JavaScript code and context-specific features applied to them:

They have no outwardly-visible effect1 unless JS code is used to fetch the elements and apply features to them. The most obvious use for hashtags would be to apply them as filters in the forum and add a way to tag forum posts. Clicking on a hashtag in the forum would filter on messages which have that tag. (Note that containing the hashtag and "having that tag" are separate things: opaque text vs. a fossil tag artifact.) One issue we'd have for that use case, though, is that fossil tags are case-sensitive and hashtags are notoriously inconsistent in their casing, so any interface for adding tags for this purpose would need to lowercase them for consistency.

The core hashtag parsing seems to work well, including support for non-ASCII hashtags, and a demo of its use is integrated into the /chat page:

  1. Tapping a #nnnnn numeric hashtag will scroll to the given message if it's been loaded. It's common to reference other messages that way in chat, and this branch now makes it easier to refer back to such references.
  2. Tapping a hashtag will filter only on messages containing that hashtag.

Potential uses for these tags include:


  1. ^ bug: #N references in headers are rendered with their SPAN element HTML-escaped. Why headers get HTML-escaped is unclear.