Artifact
5a0593111ecbdda6e19aa62146df03e3425754f2160f8384b08fb1adf1627052:
Wiki page
[branch/markdown-tagrefs] by
stephan
2024-07-03 09:32:41.
0000: 44 20 32 30 32 34 2d 30 37 2d 30 33 54 30 39 3a D 2024-07-03T09:
0010: 33 32 3a 34 31 2e 33 37 30 0a 4c 20 62 72 61 6e 32:41.370.L bran
0020: 63 68 2f 6d 61 72 6b 64 6f 77 6e 2d 74 61 67 72 ch/markdown-tagr
0030: 65 66 73 0a 4e 20 74 65 78 74 2f 78 2d 6d 61 72 efs.N text/x-mar
0040: 6b 64 6f 77 6e 0a 50 20 65 34 35 65 39 32 34 30 kdown.P e45e9240
0050: 63 30 61 61 33 34 34 38 35 35 32 66 36 38 61 34 c0aa3448552f68a4
0060: 39 33 34 65 34 35 35 33 63 34 64 61 61 61 66 32 934e4553c4daaaf2
0070: 34 36 64 34 38 35 31 38 63 33 39 37 65 36 33 64 46d48518c397e63d
0080: 62 62 66 36 34 30 31 35 0a 55 20 73 74 65 70 68 bbf64015.U steph
0090: 61 6e 0a 57 20 32 37 36 36 0a 54 68 65 20 70 75 an.W 2766.The pu
00a0: 72 70 6f 73 65 20 6f 66 20 74 68 65 20 6d 61 72 rpose of the mar
00b0: 6b 64 6f 77 6e 2d 72 65 66 73 20 62 72 61 6e 63 kdown-refs branc
00c0: 68 20 69 73 20 74 6f 20 65 78 70 65 72 69 6d 65 h is to experime
00d0: 6e 74 20 77 69 74 68 20 61 64 64 69 6e 67 20 68 nt with adding h
00e0: 61 73 68 74 61 67 20 61 6e 64 20 60 40 75 73 65 ashtag and `@use
00f0: 72 6e 61 6d 65 60 20 73 75 70 70 6f 72 74 20 69 rname` support i
0100: 6e 74 6f 20 74 68 65 20 6d 61 72 6b 64 6f 77 6e nto the markdown
0110: 20 70 61 72 73 65 72 2e 0d 0a 0d 0a 49 6e 20 73 parser.....In s
0120: 68 6f 72 74 2c 20 69 74 20 61 74 74 65 6d 70 74 hort, it attempt
0130: 73 20 74 6f 20 72 65 63 6f 67 6e 69 7a 65 20 68 s to recognize h
0140: 61 73 68 74 61 67 73 20 61 6e 64 20 60 40 75 73 ashtags and `@us
0150: 65 72 6e 61 6d 65 60 20 72 65 66 65 72 65 6e 63 ername` referenc
0160: 65 73 20 61 6e 64 20 77 72 61 70 73 20 74 68 6f es and wraps tho
0170: 73 65 20 74 6f 6b 65 6e 73 20 69 6e 20 53 50 41 se tokens in SPA
0180: 4e 20 65 6c 65 6d 65 6e 74 73 20 77 69 74 68 20 N elements with
0190: 77 65 6c 6c 2d 64 65 66 69 6e 65 64 20 63 6c 61 well-defined cla
01a0: 73 73 20 6e 61 6d 65 20 73 6f 20 74 68 61 74 20 ss name so that
01b0: 74 68 65 79 20 63 61 6e 20 62 65 20 69 64 65 6e they can be iden
01c0: 74 69 66 69 65 64 20 62 79 20 64 6f 77 6e 73 74 tified by downst
01d0: 72 65 61 6d 20 4a 61 76 61 53 63 72 69 70 74 20 ream JavaScript
01e0: 63 6f 64 65 20 61 6e 64 20 63 6f 6e 74 65 78 74 code and context
01f0: 2d 73 70 65 63 69 66 69 63 20 66 65 61 74 75 72 -specific featur
0200: 65 73 20 61 70 70 6c 69 65 64 20 74 6f 20 74 68 es applied to th
0210: 65 6d 3a 0d 0a 0d 0a 2d 20 60 23 48 61 73 68 74 em:....- `#Hasht
0220: 61 67 60 20 3d 3d 3e 20 60 3c 73 70 61 6e 20 64 ag` ==> `<span d
0230: 61 74 61 2d 68 61 73 68 74 61 67 3d 22 48 61 73 ata-hashtag="Has
0240: 68 74 61 67 22 3e 23 48 61 73 68 74 61 67 3c 2f htag">#Hashtag</
0250: 73 70 61 6e 3e 60 20 0d 0a 2d 20 60 23 6e 6e 6e span>` ..- `#nnn
0260: 6e 6e 60 20 28 6e 75 6d 65 72 69 63 29 20 3d 3d nn` (numeric) ==
0270: 3e 20 60 3c 73 70 61 6e 20 64 61 74 61 2d 6e 75 > `<span data-nu
0280: 6d 74 61 67 3d 22 6e 6e 6e 6e 6e 22 3e 23 6e 6e mtag="nnnnn">#nn
0290: 6e 6e 6e 3c 2f 73 70 61 6e 3e 60 20 0d 0a 2d 20 nnn</span>` ..-
02a0: 3c 73 3e 60 40 6e 61 6d 65 60 20 3d 3d 3e 20 60 <s>`@name` ==> `
02b0: 3c 73 70 61 6e 20 64 61 74 61 2d 61 74 72 65 66 <span data-atref
02c0: 3d 22 6e 61 6d 65 22 3e 40 6e 61 6d 65 3c 2f 73 ="name">@name</s
02d0: 70 61 6e 3e 60 3c 2f 73 3e 20 52 65 6d 6f 76 65 pan>`</s> Remove
02e0: 64 20 62 65 63 61 75 73 65 20 69 74 20 69 73 20 d because it is
02f0: 66 6c 61 6b 79 20 61 6e 64 20 69 73 20 61 77 6b flaky and is awk
0300: 77 61 72 64 20 77 69 74 68 20 65 6d 61 69 6c 2d ward with email-
0310: 73 74 79 6c 65 20 75 73 65 72 20 6e 61 6d 65 73 style user names
0320: 2e 20 54 68 65 20 6c 61 73 74 20 76 65 72 73 69 . The last versi
0330: 6f 6e 20 77 69 74 68 20 74 68 69 73 20 28 70 61 on with this (pa
0340: 72 74 69 61 6c 29 20 73 75 70 70 6f 72 74 20 77 rtial) support w
0350: 61 73 20 5b 5d 28 39 64 33 63 61 33 32 65 66 37 as [](9d3ca32ef7
0360: 61 64 35 37 30 64 35 62 29 2e 0d 0a 0d 0a 0d 0a ad570d5b).......
0370: 54 68 65 79 20 68 61 76 65 20 6e 6f 20 6f 75 74 They have no out
0380: 77 61 72 64 6c 79 2d 76 69 73 69 62 6c 65 20 65 wardly-visible e
0390: 66 66 65 63 74 5b 5e 62 75 67 2d 68 65 61 64 65 ffect[^bug-heade
03a0: 72 73 5d 20 75 6e 6c 65 73 73 20 4a 53 20 63 6f rs] unless JS co
03b0: 64 65 20 69 73 20 75 73 65 64 20 74 6f 20 66 65 de is used to fe
03c0: 74 63 68 20 74 68 65 20 65 6c 65 6d 65 6e 74 73 tch the elements
03d0: 20 61 6e 64 20 61 70 70 6c 79 20 66 65 61 74 75 and apply featu
03e0: 72 65 73 20 74 6f 20 74 68 65 6d 2e 20 54 68 65 res to them. The
03f0: 20 6d 6f 73 74 20 6f 62 76 69 6f 75 73 20 75 73 most obvious us
0400: 65 20 66 6f 72 20 68 61 73 68 74 61 67 73 20 77 e for hashtags w
0410: 6f 75 6c 64 20 62 65 20 74 6f 20 61 70 70 6c 79 ould be to apply
0420: 20 74 68 65 6d 20 61 73 20 66 69 6c 74 65 72 73 them as filters
0430: 20 69 6e 20 74 68 65 20 66 6f 72 75 6d 20 61 6e in the forum an
0440: 64 20 61 64 64 20 61 20 77 61 79 20 74 6f 20 74 d add a way to t
0450: 61 67 20 66 6f 72 75 6d 20 70 6f 73 74 73 2e 20 ag forum posts.
0460: 43 6c 69 63 6b 69 6e 67 20 6f 6e 20 61 20 68 61 Clicking on a ha
0470: 73 68 74 61 67 20 69 6e 20 74 68 65 20 66 6f 72 shtag in the for
0480: 75 6d 20 77 6f 75 6c 64 20 66 69 6c 74 65 72 20 um would filter
0490: 6f 6e 20 6d 65 73 73 61 67 65 73 20 77 68 69 63 on messages whic
04a0: 68 20 68 61 76 65 20 74 68 61 74 20 74 61 67 2e h have that tag.
04b0: 20 28 4e 6f 74 65 20 74 68 61 74 20 63 6f 6e 74 (Note that cont
04c0: 61 69 6e 69 6e 67 20 74 68 65 20 68 61 73 68 74 aining the hasht
04d0: 61 67 20 61 6e 64 20 22 68 61 76 69 6e 67 20 74 ag and "having t
04e0: 68 61 74 20 74 61 67 22 20 61 72 65 20 73 65 70 hat tag" are sep
04f0: 61 72 61 74 65 20 74 68 69 6e 67 73 3a 20 6f 70 arate things: op
0500: 61 71 75 65 20 74 65 78 74 20 76 73 2e 20 61 20 aque text vs. a
0510: 66 6f 73 73 69 6c 20 74 61 67 20 61 72 74 69 66 fossil tag artif
0520: 61 63 74 2e 29 20 4f 6e 65 20 69 73 73 75 65 20 act.) One issue
0530: 77 65 27 64 20 68 61 76 65 20 66 6f 72 20 74 68 we'd have for th
0540: 61 74 20 75 73 65 20 63 61 73 65 2c 20 74 68 6f at use case, tho
0550: 75 67 68 2c 20 69 73 20 74 68 61 74 20 66 6f 73 ugh, is that fos
0560: 73 69 6c 20 74 61 67 73 20 61 72 65 20 63 61 73 sil tags are cas
0570: 65 2d 73 65 6e 73 69 74 69 76 65 20 61 6e 64 20 e-sensitive and
0580: 68 61 73 68 74 61 67 73 20 61 72 65 20 6e 6f 74 hashtags are not
0590: 6f 72 69 6f 75 73 6c 79 20 69 6e 63 6f 6e 73 69 oriously inconsi
05a0: 73 74 65 6e 74 20 69 6e 20 74 68 65 69 72 20 63 stent in their c
05b0: 61 73 69 6e 67 2c 20 73 6f 20 61 6e 79 20 69 6e asing, so any in
05c0: 74 65 72 66 61 63 65 20 66 6f 72 20 61 64 64 69 terface for addi
05d0: 6e 67 20 74 61 67 73 20 66 6f 72 20 74 68 69 73 ng tags for this
05e0: 20 70 75 72 70 6f 73 65 20 77 6f 75 6c 64 20 6e purpose would n
05f0: 65 65 64 20 74 6f 20 6c 6f 77 65 72 63 61 73 65 eed to lowercase
0600: 20 74 68 65 6d 20 66 6f 72 20 63 6f 6e 73 69 73 them for consis
0610: 74 65 6e 63 79 2e 0d 0a 0d 0a 54 68 65 20 63 6f tency.....The co
0620: 72 65 20 68 61 73 68 74 61 67 20 70 61 72 73 69 re hashtag parsi
0630: 6e 67 20 73 65 65 6d 73 20 74 6f 20 77 6f 72 6b ng seems to work
0640: 20 77 65 6c 6c 2c 20 69 6e 63 6c 75 64 69 6e 67 well, including
0650: 20 73 75 70 70 6f 72 74 20 66 6f 72 20 6e 6f 6e support for non
0660: 2d 41 53 43 49 49 20 68 61 73 68 74 61 67 73 2c -ASCII hashtags,
0670: 20 61 6e 64 20 61 20 64 65 6d 6f 20 6f 66 20 69 and a demo of i
0680: 74 73 20 75 73 65 20 69 73 20 69 6e 74 65 67 72 ts use is integr
0690: 61 74 65 64 20 69 6e 74 6f 20 74 68 65 20 60 2f ated into the `/
06a0: 63 68 61 74 60 20 70 61 67 65 3a 20 0d 0a 0d 0a chat` page: ....
06b0: 31 2e 20 54 61 70 70 69 6e 67 20 61 20 60 23 6e 1. Tapping a `#n
06c0: 6e 6e 6e 6e 60 20 6e 75 6d 65 72 69 63 20 68 61 nnnn` numeric ha
06d0: 73 68 74 61 67 20 77 69 6c 6c 20 73 63 72 6f 6c shtag will scrol
06e0: 6c 20 74 6f 20 74 68 65 20 67 69 76 65 6e 20 6d l to the given m
06f0: 65 73 73 61 67 65 20 69 66 20 69 74 27 73 20 62 essage if it's b
0700: 65 65 6e 20 6c 6f 61 64 65 64 2e 20 49 74 27 73 een loaded. It's
0710: 20 63 6f 6d 6d 6f 6e 20 74 6f 20 72 65 66 65 72 common to refer
0720: 65 6e 63 65 20 6f 74 68 65 72 20 6d 65 73 73 61 ence other messa
0730: 67 65 73 20 74 68 61 74 20 77 61 79 20 69 6e 20 ges that way in
0740: 63 68 61 74 2c 20 61 6e 64 20 74 68 69 73 20 62 chat, and this b
0750: 72 61 6e 63 68 20 6e 6f 77 20 6d 61 6b 65 73 20 ranch now makes
0760: 69 74 20 65 61 73 69 65 72 20 74 6f 20 72 65 66 it easier to ref
0770: 65 72 20 62 61 63 6b 20 74 6f 20 73 75 63 68 20 er back to such
0780: 72 65 66 65 72 65 6e 63 65 73 2e 0d 0a 32 2e 20 references...2.
0790: 54 61 70 70 69 6e 67 20 61 20 68 61 73 68 74 61 Tapping a hashta
07a0: 67 20 77 69 6c 6c 20 66 69 6c 74 65 72 20 6f 6e g will filter on
07b0: 6c 79 20 6f 6e 20 6d 65 73 73 61 67 65 73 20 63 ly on messages c
07c0: 6f 6e 74 61 69 6e 69 6e 67 20 74 68 61 74 20 68 ontaining that h
07d0: 61 73 68 74 61 67 2e 0d 0a 0d 0a 50 6f 74 65 6e ashtag.....Poten
07e0: 74 69 61 6c 20 75 73 65 73 20 66 6f 72 20 74 68 tial uses for th
07f0: 65 73 65 20 74 61 67 73 20 69 6e 63 6c 75 64 65 ese tags include
0800: 3a 0d 0a 0d 0a 2d 20 41 20 73 65 70 61 72 61 74 :....- A separat
0810: 65 2c 20 70 72 65 73 75 6d 61 62 6c 79 20 6c 6f e, presumably lo
0820: 75 64 65 72 2f 6d 6f 72 65 20 76 69 73 69 62 6c uder/more visibl
0830: 65 2c 20 6e 6f 74 69 66 69 63 61 74 69 6f 6e 20 e, notification
0840: 69 6e 20 60 2f 63 68 61 74 60 20 77 68 65 6e 20 in `/chat` when
0850: 61 20 6d 65 73 73 61 67 65 20 63 6f 6e 74 61 69 a message contai
0860: 6e 69 6e 67 20 61 20 74 61 67 20 6f 66 20 79 6f ning a tag of yo
0870: 75 72 20 6f 77 6e 20 6e 61 6d 65 20 61 72 72 69 ur own name arri
0880: 76 65 73 2e 0d 0a 2d 20 46 69 6c 74 65 72 69 6e ves...- Filterin
0890: 67 20 60 2f 63 68 61 74 60 20 61 6e 64 20 60 2f g `/chat` and `/
08a0: 66 6f 72 75 6d 60 20 70 6f 73 74 73 20 62 79 20 forum` posts by
08b0: 61 20 75 73 65 72 2e 20 54 68 65 20 6c 61 74 74 a user. The latt
08c0: 65 72 20 72 65 71 75 69 72 65 73 20 6d 6f 72 65 er requires more
08d0: 20 55 49 20 69 6e 66 72 61 73 74 72 75 63 74 75 UI infrastructu
08e0: 72 65 20 66 6f 72 20 70 72 6f 76 69 64 69 6e 67 re for providing
08f0: 20 61 20 77 61 79 20 74 6f 20 74 61 67 20 70 6f a way to tag po
0900: 73 74 73 20 61 6e 64 20 73 65 61 72 63 68 20 65 sts and search e
0910: 6e 67 69 6e 65 20 66 65 61 74 75 72 65 73 20 66 ngine features f
0920: 6f 72 20 73 65 61 72 63 68 69 6e 67 20 62 79 20 or searching by
0930: 68 61 73 68 74 61 67 73 2e 0d 0a 2d 20 49 6e 20 hashtags...- In
0940: 74 68 65 20 66 6f 72 75 6d 2c 20 63 6f 6e 73 74 the forum, const
0950: 72 75 63 74 73 20 6c 69 6b 65 20 22 69 6e 20 72 ructs like "in r
0960: 65 73 70 6f 6e 73 65 20 74 6f 20 23 32 39 22 20 esponse to #29"
0970: 77 6f 75 6c 64 20 6c 69 6e 6b 20 74 6f 20 74 68 would link to th
0980: 65 20 6d 6f 73 74 20 72 65 63 65 6e 74 20 70 6f e most recent po
0990: 73 74 20 23 32 39 20 28 70 6f 73 73 69 62 6c 79 st #29 (possibly
09a0: 20 32 39 2e 78 29 20 69 66 20 69 74 27 73 20 6c 29.x) if it's l
09b0: 6f 61 64 65 64 20 69 6e 20 74 68 65 20 63 75 72 oaded in the cur
09c0: 72 65 6e 74 20 70 61 67 65 2e 0d 0a 0d 0a 45 78 rent page.....Ex
09d0: 61 6d 70 6c 65 20 69 6e 70 75 74 20 74 6f 20 66 ample input to f
09e0: 65 65 64 20 74 6f 20 74 68 65 20 60 74 65 73 74 eed to the `test
09f0: 2d 6d 61 72 6b 64 6f 77 6e 2d 72 65 6e 64 65 72 -markdown-render
0a00: 60 20 63 6f 6d 6d 61 6e 64 3a 0d 0a 0d 0a 3e 0d ` command:....>.
0a10: 0a 7e 7e 7e 0d 0a 5f 5f 5f 23 74 61 67 5f 5f 5f .~~~..___#tag___
0a20: 0d 0a 68 61 73 68 74 61 67 3a 20 23 31 5f 32 0d ..hashtag: #1_2.
0a30: 0a 6e 75 6d 74 61 67 3a 20 23 31 32 33 2e 34 0d .numtag: #123.4.
0a40: 0a 6e 75 6d 74 61 67 3a 20 23 31 0d 0a 6e 75 6d .numtag: #1..num
0a50: 74 61 67 20 32 2e 33 3a 20 23 32 2e 33 2e 34 0d tag 2.3: #2.3.4.
0a60: 0a 78 79 7a 0d 0a 23 5f 6e 6f 74 56 61 6c 69 64 .xyz..#_notValid
0a70: 5f 0d 0a 68 61 73 68 74 61 67 3a 20 23 74 61 67 _..hashtag: #tag
0a80: 5f 6f 6b 0d 0a 23 74 61 67 5f 5f 6e 6f 74 0d 0a _ok..#tag__not..
0a90: 23 74 61 67 4e 4f 54 23 4e 6f 74 41 54 61 67 0d #tagNOT#NotATag.
0aa0: 0a 68 61 73 68 74 61 67 20 77 2f 20 65 6d 3a 20 .hashtag w/ em:
0ab0: 2a 23 56 61 6c 69 64 54 61 67 2a 0d 0a 68 61 73 *#ValidTag*..has
0ac0: 68 74 61 67 3a 20 23 c3 a4 56 61 6c 69 64 54 c3 htag: #äValidTÃ
0ad0: 84 67 0d 0a 7e 7e 7e 0d 0a 0d 0a 5b 5e 62 75 67 „g..~~~....[^bug
0ae0: 2d 68 65 61 64 65 72 73 5d 3a 20 62 75 67 3a 20 -headers]: bug:
0af0: 60 23 4e 60 20 72 65 66 65 72 65 6e 63 65 73 20 `#N` references
0b00: 69 6e 20 68 65 61 64 65 72 73 20 61 72 65 20 72 in headers are r
0b10: 65 6e 64 65 72 65 64 20 77 69 74 68 20 74 68 65 endered with the
0b20: 69 72 20 53 50 41 4e 20 65 6c 65 6d 65 6e 74 20 ir SPAN element
0b30: 48 54 4d 4c 2d 65 73 63 61 70 65 64 2e 20 57 68 HTML-escaped. Wh
0b40: 79 20 68 65 61 64 65 72 73 20 67 65 74 20 48 54 y headers get HT
0b50: 4d 4c 2d 65 73 63 61 70 65 64 20 69 73 20 75 6e ML-escaped is un
0b60: 63 6c 65 61 72 2e 0d 0a 0a 5a 20 61 64 63 34 61 clear....Z adc4a
0b70: 65 65 64 34 37 34 66 34 39 30 38 39 35 32 32 36 eed474f490895226
0b80: 35 66 62 32 38 32 63 63 32 33 36 0a 5fb282cc236.