Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Artifact ID: | 5a0593111ecbdda6e19aa62146df03e3425754f2160f8384b08fb1adf1627052 |
---|---|
Page Name: | branch/markdown-tagrefs |
Date: | 2024-07-03 09:32:41 |
Original User: | stephan |
Mimetype: | text/x-markdown |
Parent: | e45e9240c0aa3448552f68a4934e4553c4daaaf246d48518c397e63dbbf64015 (diff) |
Next | 77ed3704643b9525665bac7f39d80db9fc008d78f18307e44af96c3eef53cd6a |
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:
#Hashtag
==><span data-hashtag="Hashtag">#Hashtag</span>
#nnnnn
(numeric) ==><span data-numtag="nnnnn">#nnnnn</span>
Removed because it is flaky and is awkward with email-style user names. The last version with this (partial) support was 9d3ca32ef7ad570d5b.@name
==><span data-atref="name">@name</span>
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:
- 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. - Tapping a hashtag will filter only on messages containing that hashtag.
Potential uses for these tags include:
- A separate, presumably louder/more visible, notification in
/chat
when a message containing a tag of your own name arrives. - Filtering
/chat
and/forum
posts by a user. The latter requires more UI infrastructure for providing a way to tag posts and search engine features for searching by hashtags. - In the forum, constructs like "in response to #29" would link to the most recent post #29 (possibly 29.x) if it's loaded in the current page.
Example input to feed to the test-markdown-render
command:
___#tag___ hashtag: #1_2 numtag: #123.4 numtag: #1 numtag 2.3: #2.3.4 xyz #_notValid_ hashtag: #tag_ok #tag__not #tagNOT#NotATag hashtag w/ em: *#ValidTag* hashtag: #äValidTÄg
- ^
bug:
#N
references in headers are rendered with their SPAN element HTML-escaped. Why headers get HTML-escaped is unclear.