Fossil SCM

Add the timeline-markdown-span setting that controls whether or not markdown span markup will be interpreted in check-in comments. Add auto-links. Support for emphasis and code marks is pending.

drh 2025-03-04 12:21 comment-markdown-links
Commit 8f55b909c4d23d066ba49d67d5b1d8c38e6e27d4ecde14036f8e53747ebb48fa
--- src/configure.c
+++ src/configure.c
@@ -106,10 +106,11 @@
106106
{ "timeline-date-format", CONFIGSET_SKIN },
107107
{ "timeline-default-style", CONFIGSET_SKIN },
108108
{ "timeline-dwelltime", CONFIGSET_SKIN },
109109
{ "timeline-closetime", CONFIGSET_SKIN },
110110
{ "timeline-hard-newlines", CONFIGSET_SKIN },
111
+ { "timeline-markdown-span", CONFIGSET_SKIN },
111112
{ "timeline-max-comment", CONFIGSET_SKIN },
112113
{ "timeline-plaintext", CONFIGSET_SKIN },
113114
{ "timeline-truncate-at-blank", CONFIGSET_SKIN },
114115
{ "timeline-tslink-info", CONFIGSET_SKIN },
115116
{ "timeline-utc", CONFIGSET_SKIN },
116117
--- src/configure.c
+++ src/configure.c
@@ -106,10 +106,11 @@
106 { "timeline-date-format", CONFIGSET_SKIN },
107 { "timeline-default-style", CONFIGSET_SKIN },
108 { "timeline-dwelltime", CONFIGSET_SKIN },
109 { "timeline-closetime", CONFIGSET_SKIN },
110 { "timeline-hard-newlines", CONFIGSET_SKIN },
 
111 { "timeline-max-comment", CONFIGSET_SKIN },
112 { "timeline-plaintext", CONFIGSET_SKIN },
113 { "timeline-truncate-at-blank", CONFIGSET_SKIN },
114 { "timeline-tslink-info", CONFIGSET_SKIN },
115 { "timeline-utc", CONFIGSET_SKIN },
116
--- src/configure.c
+++ src/configure.c
@@ -106,10 +106,11 @@
106 { "timeline-date-format", CONFIGSET_SKIN },
107 { "timeline-default-style", CONFIGSET_SKIN },
108 { "timeline-dwelltime", CONFIGSET_SKIN },
109 { "timeline-closetime", CONFIGSET_SKIN },
110 { "timeline-hard-newlines", CONFIGSET_SKIN },
111 { "timeline-markdown-span", CONFIGSET_SKIN },
112 { "timeline-max-comment", CONFIGSET_SKIN },
113 { "timeline-plaintext", CONFIGSET_SKIN },
114 { "timeline-truncate-at-blank", CONFIGSET_SKIN },
115 { "timeline-tslink-info", CONFIGSET_SKIN },
116 { "timeline-utc", CONFIGSET_SKIN },
117
+4 -3
--- src/printf.c
+++ src/printf.c
@@ -257,20 +257,21 @@
257257
if( wikiFlags==0 ){
258258
if( db_get_boolean("timeline-block-markup", 0) ){
259259
wikiFlags = WIKI_INLINE | WIKI_NOBADLINKS;
260260
}else{
261261
wikiFlags = WIKI_INLINE | WIKI_NOBLOCK | WIKI_NOBADLINKS;
262
+ }
263
+ if( db_get_boolean("timeline-markdown-span", 0) ){
264
+ wikiFlags |= WIKI_MARKDOWN_SPAN;
262265
}
263266
if( db_get_boolean("timeline-plaintext", 0) ){
264267
wikiFlags |= WIKI_LINKSONLY;
268
+ wikiFlags &= ~WIKI_MARKDOWN_SPAN;
265269
}
266270
if( db_get_boolean("timeline-hard-newlines", 0) ){
267271
wikiFlags |= WIKI_NEWLINE;
268272
}
269
- if( db_get_boolean("timeline-markdown-span", 1) ){
270
- wikiFlags |= WIKI_MARKDOWN_SPAN;
271
- }
272273
}
273274
if( altForm2 ){
274275
/* block markup (ex: <p>, <table>) allowed */
275276
return wikiFlags & ~WIKI_NOBLOCK;
276277
}else{
277278
--- src/printf.c
+++ src/printf.c
@@ -257,20 +257,21 @@
257 if( wikiFlags==0 ){
258 if( db_get_boolean("timeline-block-markup", 0) ){
259 wikiFlags = WIKI_INLINE | WIKI_NOBADLINKS;
260 }else{
261 wikiFlags = WIKI_INLINE | WIKI_NOBLOCK | WIKI_NOBADLINKS;
 
 
 
262 }
263 if( db_get_boolean("timeline-plaintext", 0) ){
264 wikiFlags |= WIKI_LINKSONLY;
 
265 }
266 if( db_get_boolean("timeline-hard-newlines", 0) ){
267 wikiFlags |= WIKI_NEWLINE;
268 }
269 if( db_get_boolean("timeline-markdown-span", 1) ){
270 wikiFlags |= WIKI_MARKDOWN_SPAN;
271 }
272 }
273 if( altForm2 ){
274 /* block markup (ex: <p>, <table>) allowed */
275 return wikiFlags & ~WIKI_NOBLOCK;
276 }else{
277
--- src/printf.c
+++ src/printf.c
@@ -257,20 +257,21 @@
257 if( wikiFlags==0 ){
258 if( db_get_boolean("timeline-block-markup", 0) ){
259 wikiFlags = WIKI_INLINE | WIKI_NOBADLINKS;
260 }else{
261 wikiFlags = WIKI_INLINE | WIKI_NOBLOCK | WIKI_NOBADLINKS;
262 }
263 if( db_get_boolean("timeline-markdown-span", 0) ){
264 wikiFlags |= WIKI_MARKDOWN_SPAN;
265 }
266 if( db_get_boolean("timeline-plaintext", 0) ){
267 wikiFlags |= WIKI_LINKSONLY;
268 wikiFlags &= ~WIKI_MARKDOWN_SPAN;
269 }
270 if( db_get_boolean("timeline-hard-newlines", 0) ){
271 wikiFlags |= WIKI_NEWLINE;
272 }
 
 
 
273 }
274 if( altForm2 ){
275 /* block markup (ex: <p>, <table>) allowed */
276 return wikiFlags & ~WIKI_NOBLOCK;
277 }else{
278
+13 -2
--- src/setup.c
+++ src/setup.c
@@ -1005,16 +1005,27 @@
10051005
"timeline-block-markup", "tbm", 0, 0);
10061006
@ <p>In timeline displays, check-in comments can be displayed with or
10071007
@ without block markup such as paragraphs, tables, etc.
10081008
@ (Property: "timeline-block-markup")</p>
10091009
1010
+ @ <hr>
1011
+ onoff_attribute("Allow markdown style span-markup in timeline",
1012
+ "timeline-markdown-span", "tms", 0, 0);
1013
+ @ <p>In timeline displays, intrepret <a href="%R/md_rules">markdown</a>
1014
+ @ span markup (hyperlinks and emphasis marks such as "<tt>**bold**</tt>"
1015
+ @ but not headers, paragraphs, tables, footnotes, etc.) in check-in
1016
+ @ comments. Without this option, only <a href="%R/wiki_rules">Fossil Wiki</a>
1017
+ @ formatting is allowed.
1018
+ @ (Property: "timeline-markdown-span")</p>
1019
+
10101020
@ <hr>
10111021
onoff_attribute("Plaintext comments on timelines",
10121022
"timeline-plaintext", "tpt", 0, 0);
10131023
@ <p>In timeline displays, check-in comments are displayed literally,
1014
- @ without any wiki or HTML interpretation. Use CSS to change
1015
- @ display formatting features such as fonts and line-wrapping behavior.
1024
+ @ without any wiki or HTML interpretation. This setting takes priority
1025
+ @ over the timeline-block-markup and timeline-markdown-span settings
1026
+ @ above.
10161027
@ (Property: "timeline-plaintext")</p>
10171028
10181029
@ <hr>
10191030
onoff_attribute("Truncate comment at first blank line (Git-style)",
10201031
"timeline-truncate-at-blank", "ttb", 0, 0);
10211032
--- src/setup.c
+++ src/setup.c
@@ -1005,16 +1005,27 @@
1005 "timeline-block-markup", "tbm", 0, 0);
1006 @ <p>In timeline displays, check-in comments can be displayed with or
1007 @ without block markup such as paragraphs, tables, etc.
1008 @ (Property: "timeline-block-markup")</p>
1009
 
 
 
 
 
 
 
 
 
 
1010 @ <hr>
1011 onoff_attribute("Plaintext comments on timelines",
1012 "timeline-plaintext", "tpt", 0, 0);
1013 @ <p>In timeline displays, check-in comments are displayed literally,
1014 @ without any wiki or HTML interpretation. Use CSS to change
1015 @ display formatting features such as fonts and line-wrapping behavior.
 
1016 @ (Property: "timeline-plaintext")</p>
1017
1018 @ <hr>
1019 onoff_attribute("Truncate comment at first blank line (Git-style)",
1020 "timeline-truncate-at-blank", "ttb", 0, 0);
1021
--- src/setup.c
+++ src/setup.c
@@ -1005,16 +1005,27 @@
1005 "timeline-block-markup", "tbm", 0, 0);
1006 @ <p>In timeline displays, check-in comments can be displayed with or
1007 @ without block markup such as paragraphs, tables, etc.
1008 @ (Property: "timeline-block-markup")</p>
1009
1010 @ <hr>
1011 onoff_attribute("Allow markdown style span-markup in timeline",
1012 "timeline-markdown-span", "tms", 0, 0);
1013 @ <p>In timeline displays, intrepret <a href="%R/md_rules">markdown</a>
1014 @ span markup (hyperlinks and emphasis marks such as "<tt>**bold**</tt>"
1015 @ but not headers, paragraphs, tables, footnotes, etc.) in check-in
1016 @ comments. Without this option, only <a href="%R/wiki_rules">Fossil Wiki</a>
1017 @ formatting is allowed.
1018 @ (Property: "timeline-markdown-span")</p>
1019
1020 @ <hr>
1021 onoff_attribute("Plaintext comments on timelines",
1022 "timeline-plaintext", "tpt", 0, 0);
1023 @ <p>In timeline displays, check-in comments are displayed literally,
1024 @ without any wiki or HTML interpretation. This setting takes priority
1025 @ over the timeline-block-markup and timeline-markdown-span settings
1026 @ above.
1027 @ (Property: "timeline-plaintext")</p>
1028
1029 @ <hr>
1030 onoff_attribute("Truncate comment at first blank line (Git-style)",
1031 "timeline-truncate-at-blank", "ttb", 0, 0);
1032
--- src/wiki.wiki
+++ src/wiki.wiki
@@ -6,10 +6,11 @@
66
spaces at the beginning of a line
77
# Indented paragraphs begin with a tab or two spaces
88
# Hyperlinks are contained within square brackets:
99
<nowiki>"<b>[</b><i>target</i><b>]</b>"
1010
or "<b>[</b><i>target</i><b>|</b><i>label</i><b>]</b>"</nowiki>
11
+ or "<b>&lt;</b><i>URL</i><b>&gt;</b>"
1112
# Most ordinary HTML works
1213
# &lt;verbatim&gt; and &lt;nowiki&gt;
1314
1415
We call the first five rules above the "wiki" formatting rules.
1516
The last two rules are the HTML formatting rules.
@@ -52,10 +53,16 @@
5253
But you can specify alternative text after the target name
5354
separated by a "|" character.
5455
You can also link to internal anchor names using
5556
<nowiki>[#anchor-name],</nowiki> providing you have added the necessary
5657
"&lt;a name='anchor-name'&gt;&lt;/a&gt;" tag to your wiki page.
58
+ <p>
59
+ Support for "auto-link" hyperlinks consisting of a URL that begins
60
+ with "http://" or "https://" and that is enclosed in &lt;...&gt; was
61
+ added on 2025-03-04. Formerly, such text would be displayed literally.
62
+ The change is that now the URL is rendered enclosed within
63
+ &lt;a&gt;...&lt;/a&gt; so that it actually functions as a hyperlink.
5764
5865
6. <b>HTML.</b>
5966
The following standard HTML elements may be used:
6067
&lt;a&gt; &lt;address&gt; &lt;article&gt; &lt;aside&gt; &lt;b&gt;
6168
&lt;big&gt; &lt;blockquote&gt; &lt;br&gt; &lt;center&gt; &lt;cite&gt;
6269
--- src/wiki.wiki
+++ src/wiki.wiki
@@ -6,10 +6,11 @@
6 spaces at the beginning of a line
7 # Indented paragraphs begin with a tab or two spaces
8 # Hyperlinks are contained within square brackets:
9 <nowiki>"<b>[</b><i>target</i><b>]</b>"
10 or "<b>[</b><i>target</i><b>|</b><i>label</i><b>]</b>"</nowiki>
 
11 # Most ordinary HTML works
12 # &lt;verbatim&gt; and &lt;nowiki&gt;
13
14 We call the first five rules above the "wiki" formatting rules.
15 The last two rules are the HTML formatting rules.
@@ -52,10 +53,16 @@
52 But you can specify alternative text after the target name
53 separated by a "|" character.
54 You can also link to internal anchor names using
55 <nowiki>[#anchor-name],</nowiki> providing you have added the necessary
56 "&lt;a name='anchor-name'&gt;&lt;/a&gt;" tag to your wiki page.
 
 
 
 
 
 
57
58 6. <b>HTML.</b>
59 The following standard HTML elements may be used:
60 &lt;a&gt; &lt;address&gt; &lt;article&gt; &lt;aside&gt; &lt;b&gt;
61 &lt;big&gt; &lt;blockquote&gt; &lt;br&gt; &lt;center&gt; &lt;cite&gt;
62
--- src/wiki.wiki
+++ src/wiki.wiki
@@ -6,10 +6,11 @@
6 spaces at the beginning of a line
7 # Indented paragraphs begin with a tab or two spaces
8 # Hyperlinks are contained within square brackets:
9 <nowiki>"<b>[</b><i>target</i><b>]</b>"
10 or "<b>[</b><i>target</i><b>|</b><i>label</i><b>]</b>"</nowiki>
11 or "<b>&lt;</b><i>URL</i><b>&gt;</b>"
12 # Most ordinary HTML works
13 # &lt;verbatim&gt; and &lt;nowiki&gt;
14
15 We call the first five rules above the "wiki" formatting rules.
16 The last two rules are the HTML formatting rules.
@@ -52,10 +53,16 @@
53 But you can specify alternative text after the target name
54 separated by a "|" character.
55 You can also link to internal anchor names using
56 <nowiki>[#anchor-name],</nowiki> providing you have added the necessary
57 "&lt;a name='anchor-name'&gt;&lt;/a&gt;" tag to your wiki page.
58 <p>
59 Support for "auto-link" hyperlinks consisting of a URL that begins
60 with "http://" or "https://" and that is enclosed in &lt;...&gt; was
61 added on 2025-03-04. Formerly, such text would be displayed literally.
62 The change is that now the URL is rendered enclosed within
63 &lt;a&gt;...&lt;/a&gt; so that it actually functions as a hyperlink.
64
65 6. <b>HTML.</b>
66 The following standard HTML elements may be used:
67 &lt;a&gt; &lt;address&gt; &lt;article&gt; &lt;aside&gt; &lt;b&gt;
68 &lt;big&gt; &lt;blockquote&gt; &lt;br&gt; &lt;center&gt; &lt;cite&gt;
69
+13 -6
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -1660,18 +1660,25 @@
16601660
blob_append(p->pOut, z, n);
16611661
}
16621662
break;
16631663
}
16641664
case TOKEN_AUTOLINK: {
1665
- /* URL enclosed in <...> */
1665
+ /* URL enclosed in <...>
1666
+ **
1667
+ ** Originally, Fossil-Wiki would just display this as literal
1668
+ ** text, but as of 2025-03-04, it actually inserts an <a>..</a>
1669
+ ** for the hyperlink. The <...> delimiters are retained, however.
1670
+ ** Except in markdown-span mode, the <...> delimiters are omitted.
1671
+ */
16661672
if( (p->state & WIKI_MARKDOWN_SPAN)==0 ){
16671673
blob_append(p->pOut, "&lt;", 4);
1668
- n = 1;
1669
- }else{
1670
- z[n-1] = 0;
1671
- blob_appendf(p->pOut, "<a href=\"%h\">%h</a>", z+1, z+1);
1672
- z[n-1] = '>';
1674
+ }
1675
+ z[n-1] = 0;
1676
+ blob_appendf(p->pOut, "<a href=\"%h\">%h</a>", z+1, z+1);
1677
+ z[n-1] = '>';
1678
+ if( (p->state & WIKI_MARKDOWN_SPAN)==0 ){
1679
+ blob_append(p->pOut, "&gt;", 4);
16731680
}
16741681
break;
16751682
}
16761683
case TOKEN_MARKUP: {
16771684
const char *zId;
16781685
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -1660,18 +1660,25 @@
1660 blob_append(p->pOut, z, n);
1661 }
1662 break;
1663 }
1664 case TOKEN_AUTOLINK: {
1665 /* URL enclosed in <...> */
 
 
 
 
 
 
1666 if( (p->state & WIKI_MARKDOWN_SPAN)==0 ){
1667 blob_append(p->pOut, "&lt;", 4);
1668 n = 1;
1669 }else{
1670 z[n-1] = 0;
1671 blob_appendf(p->pOut, "<a href=\"%h\">%h</a>", z+1, z+1);
1672 z[n-1] = '>';
 
1673 }
1674 break;
1675 }
1676 case TOKEN_MARKUP: {
1677 const char *zId;
1678
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -1660,18 +1660,25 @@
1660 blob_append(p->pOut, z, n);
1661 }
1662 break;
1663 }
1664 case TOKEN_AUTOLINK: {
1665 /* URL enclosed in <...>
1666 **
1667 ** Originally, Fossil-Wiki would just display this as literal
1668 ** text, but as of 2025-03-04, it actually inserts an <a>..</a>
1669 ** for the hyperlink. The <...> delimiters are retained, however.
1670 ** Except in markdown-span mode, the <...> delimiters are omitted.
1671 */
1672 if( (p->state & WIKI_MARKDOWN_SPAN)==0 ){
1673 blob_append(p->pOut, "&lt;", 4);
1674 }
1675 z[n-1] = 0;
1676 blob_appendf(p->pOut, "<a href=\"%h\">%h</a>", z+1, z+1);
1677 z[n-1] = '>';
1678 if( (p->state & WIKI_MARKDOWN_SPAN)==0 ){
1679 blob_append(p->pOut, "&gt;", 4);
1680 }
1681 break;
1682 }
1683 case TOKEN_MARKUP: {
1684 const char *zId;
1685

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button