Fossil SCM

A single new setting "wiki-classic" switches wiki display between the circa-2007 classic wiki and the new 2025 enhanced wiki.

drh 2025-03-14 13:03 comment-markdown-links
Commit 918a2e2c5e1e047a3da4b27ebbfe5db26fec7078d912799c155eca0cb9f67f85
+1 -1
--- src/backlink.c
+++ src/backlink.c
@@ -372,11 +372,11 @@
372372
bklnk.srctype = srctype;
373373
bklnk.mtime = mtime;
374374
if( mimetype==MT_NONE || mimetype==MT_WIKI ){
375375
int flags;
376376
if( srctype==BKLNK_COMMENT ){
377
- flags = WIKI_INLINE | WIKI_MARKDOWN_LINK;
377
+ flags = WIKI_INLINE | WIKI_MARKDOWN_LINK | WIKI_OVERRIDE;
378378
}else{
379379
flags = 0;
380380
}
381381
wiki_extract_links(zSrc, &bklnk, flags);
382382
}else if( mimetype==MT_MARKDOWN ){
383383
--- src/backlink.c
+++ src/backlink.c
@@ -372,11 +372,11 @@
372 bklnk.srctype = srctype;
373 bklnk.mtime = mtime;
374 if( mimetype==MT_NONE || mimetype==MT_WIKI ){
375 int flags;
376 if( srctype==BKLNK_COMMENT ){
377 flags = WIKI_INLINE | WIKI_MARKDOWN_LINK;
378 }else{
379 flags = 0;
380 }
381 wiki_extract_links(zSrc, &bklnk, flags);
382 }else if( mimetype==MT_MARKDOWN ){
383
--- src/backlink.c
+++ src/backlink.c
@@ -372,11 +372,11 @@
372 bklnk.srctype = srctype;
373 bklnk.mtime = mtime;
374 if( mimetype==MT_NONE || mimetype==MT_WIKI ){
375 int flags;
376 if( srctype==BKLNK_COMMENT ){
377 flags = WIKI_INLINE | WIKI_MARKDOWN_LINK | WIKI_OVERRIDE;
378 }else{
379 flags = 0;
380 }
381 wiki_extract_links(zSrc, &bklnk, flags);
382 }else if( mimetype==MT_MARKDOWN ){
383
+1 -1
--- src/main.mk
+++ src/main.mk
@@ -277,11 +277,11 @@
277277
$(SRCDIR)/style.pikchrshow.css \
278278
$(SRCDIR)/style.uvlist.css \
279279
$(SRCDIR)/style.wikiedit.css \
280280
$(SRCDIR)/tree.js \
281281
$(SRCDIR)/useredit.js \
282
- $(SRCDIR)/wiki.wiki
282
+ $(SRCDIR)/wiki-rules.txt
283283
284284
TRANS_SRC = \
285285
$(OBJDIR)/add_.c \
286286
$(OBJDIR)/ajax_.c \
287287
$(OBJDIR)/alerts_.c \
288288
--- src/main.mk
+++ src/main.mk
@@ -277,11 +277,11 @@
277 $(SRCDIR)/style.pikchrshow.css \
278 $(SRCDIR)/style.uvlist.css \
279 $(SRCDIR)/style.wikiedit.css \
280 $(SRCDIR)/tree.js \
281 $(SRCDIR)/useredit.js \
282 $(SRCDIR)/wiki.wiki
283
284 TRANS_SRC = \
285 $(OBJDIR)/add_.c \
286 $(OBJDIR)/ajax_.c \
287 $(OBJDIR)/alerts_.c \
288
--- src/main.mk
+++ src/main.mk
@@ -277,11 +277,11 @@
277 $(SRCDIR)/style.pikchrshow.css \
278 $(SRCDIR)/style.uvlist.css \
279 $(SRCDIR)/style.wikiedit.css \
280 $(SRCDIR)/tree.js \
281 $(SRCDIR)/useredit.js \
282 $(SRCDIR)/wiki-rules.txt
283
284 TRANS_SRC = \
285 $(OBJDIR)/add_.c \
286 $(OBJDIR)/ajax_.c \
287 $(OBJDIR)/alerts_.c \
288
+6 -11
--- src/printf.c
+++ src/printf.c
@@ -267,17 +267,16 @@
267267
** treated like any other whitespace character.
268268
*/
269269
270270
/*
271271
** Return an appropriate set of flags for wiki_convert() for displaying
272
-** comments on a timeline. These flag settings are determined by
273
-** configuration parameters.
272
+** check-in comments on a timeline (%W) or for general display (%!W).
273
+** The flags are determined by settings.
274274
**
275
-** The altForm2 argument is true for "%!W" (with the "!" alternate-form-2
276
-** flags) and is false for plain "%W". The ! indicates that the text is
277
-** to be rendered on a form rather than the timeline and that block markup
278
-** is acceptable even if the "timeline-block-markup" setting is false.
275
+** The altForm2 argument is true for "%!W" (indicating that the rendered
276
+** wiki text is for general display) and false for "%W" (indicating that
277
+** the text is being displayed in a timeline.
279278
*/
280279
static int wiki_convert_flags(int altForm2){
281280
static int wikiFlags = 0;
282281
if( wikiFlags==0 ){
283282
if( db_get_boolean("timeline-block-markup", 0) ){
@@ -284,16 +283,12 @@
284283
wikiFlags = WIKI_INLINE | WIKI_NOBADLINKS;
285284
}else{
286285
wikiFlags = WIKI_INLINE | WIKI_NOBLOCK | WIKI_NOBADLINKS;
287286
}
288287
if( db_get_boolean("timeline-plaintext", 0) ){
289
- wikiFlags |= WIKI_LINKSONLY;
288
+ wikiFlags |= WIKI_LINKSONLY | WIKI_OVERRIDE;
290289
wikiFlags &= ~WIKI_MARKDOWN_INLINE;
291
- }else{
292
- int x = db_get_int("timeline-markdown", 0);
293
- if( x & 1 ) wikiFlags |= WIKI_MARKDOWN_LINK;
294
- if( x & 2 ) wikiFlags |= WIKI_MARKDOWN_FONT;
295290
}
296291
if( db_get_boolean("timeline-hard-newlines", 0) ){
297292
wikiFlags |= WIKI_NEWLINE;
298293
}
299294
}
300295
--- src/printf.c
+++ src/printf.c
@@ -267,17 +267,16 @@
267 ** treated like any other whitespace character.
268 */
269
270 /*
271 ** Return an appropriate set of flags for wiki_convert() for displaying
272 ** comments on a timeline. These flag settings are determined by
273 ** configuration parameters.
274 **
275 ** The altForm2 argument is true for "%!W" (with the "!" alternate-form-2
276 ** flags) and is false for plain "%W". The ! indicates that the text is
277 ** to be rendered on a form rather than the timeline and that block markup
278 ** is acceptable even if the "timeline-block-markup" setting is false.
279 */
280 static int wiki_convert_flags(int altForm2){
281 static int wikiFlags = 0;
282 if( wikiFlags==0 ){
283 if( db_get_boolean("timeline-block-markup", 0) ){
@@ -284,16 +283,12 @@
284 wikiFlags = WIKI_INLINE | WIKI_NOBADLINKS;
285 }else{
286 wikiFlags = WIKI_INLINE | WIKI_NOBLOCK | WIKI_NOBADLINKS;
287 }
288 if( db_get_boolean("timeline-plaintext", 0) ){
289 wikiFlags |= WIKI_LINKSONLY;
290 wikiFlags &= ~WIKI_MARKDOWN_INLINE;
291 }else{
292 int x = db_get_int("timeline-markdown", 0);
293 if( x & 1 ) wikiFlags |= WIKI_MARKDOWN_LINK;
294 if( x & 2 ) wikiFlags |= WIKI_MARKDOWN_FONT;
295 }
296 if( db_get_boolean("timeline-hard-newlines", 0) ){
297 wikiFlags |= WIKI_NEWLINE;
298 }
299 }
300
--- src/printf.c
+++ src/printf.c
@@ -267,17 +267,16 @@
267 ** treated like any other whitespace character.
268 */
269
270 /*
271 ** Return an appropriate set of flags for wiki_convert() for displaying
272 ** check-in comments on a timeline (%W) or for general display (%!W).
273 ** The flags are determined by settings.
274 **
275 ** The altForm2 argument is true for "%!W" (indicating that the rendered
276 ** wiki text is for general display) and false for "%W" (indicating that
277 ** the text is being displayed in a timeline.
 
278 */
279 static int wiki_convert_flags(int altForm2){
280 static int wikiFlags = 0;
281 if( wikiFlags==0 ){
282 if( db_get_boolean("timeline-block-markup", 0) ){
@@ -284,16 +283,12 @@
283 wikiFlags = WIKI_INLINE | WIKI_NOBADLINKS;
284 }else{
285 wikiFlags = WIKI_INLINE | WIKI_NOBLOCK | WIKI_NOBADLINKS;
286 }
287 if( db_get_boolean("timeline-plaintext", 0) ){
288 wikiFlags |= WIKI_LINKSONLY | WIKI_OVERRIDE;
289 wikiFlags &= ~WIKI_MARKDOWN_INLINE;
 
 
 
 
290 }
291 if( db_get_boolean("timeline-hard-newlines", 0) ){
292 wikiFlags |= WIKI_NEWLINE;
293 }
294 }
295
+24 -22
--- src/setup.c
+++ src/setup.c
@@ -988,16 +988,10 @@
988988
"1", "HH:MM:SS",
989989
"2", "YYYY-MM-DD HH:MM",
990990
"3", "YYMMDD HH:MM",
991991
"4", "(off)"
992992
};
993
- static const char *const azMarkdown[] = {
994
- "0", "none",
995
- "1", "hyperlinks only",
996
- "2", "styling only",
997
- "3", "links and styling",
998
- };
999993
login_check_credentials();
1000994
if( !g.perm.Admin ){
1001995
login_needed(0);
1002996
return;
1003997
}
@@ -1014,24 +1008,10 @@
10141008
"timeline-block-markup", "tbm", 0, 0);
10151009
@ <p>In timeline displays, check-in comments can be displayed with or
10161010
@ without block markup such as paragraphs, tables, etc.
10171011
@ (Property: "timeline-block-markup")</p>
10181012
1019
- @ <hr>
1020
- multiple_choice_attribute("Allow Markdown in timeline comments",
1021
- "timeline-markdown", "tmkdn", "0",
1022
- count(azMarkdown)/2, azMarkdown);
1023
- @ <p>Allow or disallow a limited amount of Markdown-style format marks
1024
- @ for check-in comments displayed in the timeline. Normally check-in
1025
- @ comments use only <a href="%R/wiki_rules">Fossil Wiki</a>. This option
1026
- @ allows some types of Markdown to be used as well:
1027
- @ <ul><li>hyperlinks: <b>(</b><i>display</i><b>)[</b><i>target</i><b>]</b> \
1028
- @ and <b>&lt;</b><i>URL</i><b>&gt;</b>.
1029
- @ <li>styling: *<i>emphasis</i>*, **<b>bold</b>**, `<tt>literal</tt>`, \
1030
- @ <b>\</b>-escapes</ul>
1031
- @ (Property: "timeline-markdown")</p>
1032
-
10331013
@ <hr>
10341014
onoff_attribute("Plaintext comments on timelines",
10351015
"timeline-plaintext", "tpt", 0, 0);
10361016
@ <p>In timeline displays, check-in comments are displayed literally,
10371017
@ without any wiki or HTML interpretation. This setting takes priority
@@ -1452,12 +1432,12 @@
14521432
db_begin_transaction();
14531433
@ <form action="%R/setup_wiki" method="post"><div>
14541434
login_insert_csrf_secret();
14551435
@ <input type="submit" name="submit" value="Apply Changes"></p>
14561436
@ <hr>
1457
- onoff_attribute("Associate Wiki Pages With Branches, Tags, Tickets, or Checkins",
1458
- "wiki-about", "wiki-about", 1, 0);
1437
+ onoff_attribute("Associate Wiki Pages With Branches, Tags, Tickets,"
1438
+ " or Checkins", "wiki-about", "wiki-about", 1, 0);
14591439
@ <p>
14601440
@ Associate wiki pages with branches, tags, tickets, or checkins, based on
14611441
@ the wiki page name. Wiki pages that begin with "branch/", "checkin/",
14621442
@ "tag/" or "ticket" and which continue with the name of an existing branch,
14631443
@ check-in, tag or ticket are treated specially when this feature is enabled.
@@ -1466,10 +1446,32 @@
14661446
@ <li> <b>checkin/</b><i>full-check-in-hash</i>
14671447
@ <li> <b>tag/</b><i>tag-name</i>
14681448
@ <li> <b>ticket/</b><i>full-ticket-hash</i>
14691449
@ </ul>
14701450
@ (Property: "wiki-about")</p>
1451
+ @ <hr>
1452
+ onoff_attribute("Disable the 2025 enhancements to wiki formatting rules",
1453
+ "wiki-classic", "wiki-classic", 0, 0);
1454
+ @ <p>When enabled, only the original circa-2007 wiki formatting rules are
1455
+ @ recognized. The new formatting rules added in 2025 are ignored. Enable
1456
+ @ this setting if you are hosting an older repository that has preexisting
1457
+ @ wiki content that is adversely affected by the new rules.
1458
+ @ The enhanced wiki formatting rules added in 2025 are:
1459
+ @ <ul>
1460
+ @ <li> Markdown-style hyperlinks:&emsp;\
1461
+ @ <tt>[display](URL)</tt>
1462
+ @ <li> Angle-bracket hyperlinks:&emsp; <tt>&lt;URL&gt;</tt>
1463
+ @ <li> Font changes:&emsp;
1464
+ @ <tt>*italic*</tt> &emsp;\
1465
+ @ <tt>**bold**</tt> &emsp;\
1466
+ @ <tt>`teletype`</tt>
1467
+ @ <li> Backslash escapes:&emsp;\
1468
+ @ <tt>\&gt;</tt> &ensp; <tt>\[</tt> &ensp; <tt>\*</tt> &ensp;
1469
+ @ <tt>\_</tt> &ensp; <tt>\'</tt> &ensp; <tt>\\</tt> &emsp;
1470
+ @ <i>and so forth...</i>
1471
+ @ </ul>
1472
+ @ (Property: "wiki-classic")
14711473
@ <hr>
14721474
entry_attribute("Allow Unsafe HTML In Markdown", 6,
14731475
"safe-html", "safe-html", "", 0);
14741476
@ <p>Allow "unsafe" HTML (ex: &lt;script&gt;, &lt;form&gt;, etc) to be
14751477
@ generated by <a href="%R/md_rules">Markdown-formatted</a> documents.
14761478
14771479
ADDED src/wiki-rules.txt
--- src/setup.c
+++ src/setup.c
@@ -988,16 +988,10 @@
988 "1", "HH:MM:SS",
989 "2", "YYYY-MM-DD HH:MM",
990 "3", "YYMMDD HH:MM",
991 "4", "(off)"
992 };
993 static const char *const azMarkdown[] = {
994 "0", "none",
995 "1", "hyperlinks only",
996 "2", "styling only",
997 "3", "links and styling",
998 };
999 login_check_credentials();
1000 if( !g.perm.Admin ){
1001 login_needed(0);
1002 return;
1003 }
@@ -1014,24 +1008,10 @@
1014 "timeline-block-markup", "tbm", 0, 0);
1015 @ <p>In timeline displays, check-in comments can be displayed with or
1016 @ without block markup such as paragraphs, tables, etc.
1017 @ (Property: "timeline-block-markup")</p>
1018
1019 @ <hr>
1020 multiple_choice_attribute("Allow Markdown in timeline comments",
1021 "timeline-markdown", "tmkdn", "0",
1022 count(azMarkdown)/2, azMarkdown);
1023 @ <p>Allow or disallow a limited amount of Markdown-style format marks
1024 @ for check-in comments displayed in the timeline. Normally check-in
1025 @ comments use only <a href="%R/wiki_rules">Fossil Wiki</a>. This option
1026 @ allows some types of Markdown to be used as well:
1027 @ <ul><li>hyperlinks: <b>(</b><i>display</i><b>)[</b><i>target</i><b>]</b> \
1028 @ and <b>&lt;</b><i>URL</i><b>&gt;</b>.
1029 @ <li>styling: *<i>emphasis</i>*, **<b>bold</b>**, `<tt>literal</tt>`, \
1030 @ <b>\</b>-escapes</ul>
1031 @ (Property: "timeline-markdown")</p>
1032
1033 @ <hr>
1034 onoff_attribute("Plaintext comments on timelines",
1035 "timeline-plaintext", "tpt", 0, 0);
1036 @ <p>In timeline displays, check-in comments are displayed literally,
1037 @ without any wiki or HTML interpretation. This setting takes priority
@@ -1452,12 +1432,12 @@
1452 db_begin_transaction();
1453 @ <form action="%R/setup_wiki" method="post"><div>
1454 login_insert_csrf_secret();
1455 @ <input type="submit" name="submit" value="Apply Changes"></p>
1456 @ <hr>
1457 onoff_attribute("Associate Wiki Pages With Branches, Tags, Tickets, or Checkins",
1458 "wiki-about", "wiki-about", 1, 0);
1459 @ <p>
1460 @ Associate wiki pages with branches, tags, tickets, or checkins, based on
1461 @ the wiki page name. Wiki pages that begin with "branch/", "checkin/",
1462 @ "tag/" or "ticket" and which continue with the name of an existing branch,
1463 @ check-in, tag or ticket are treated specially when this feature is enabled.
@@ -1466,10 +1446,32 @@
1466 @ <li> <b>checkin/</b><i>full-check-in-hash</i>
1467 @ <li> <b>tag/</b><i>tag-name</i>
1468 @ <li> <b>ticket/</b><i>full-ticket-hash</i>
1469 @ </ul>
1470 @ (Property: "wiki-about")</p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1471 @ <hr>
1472 entry_attribute("Allow Unsafe HTML In Markdown", 6,
1473 "safe-html", "safe-html", "", 0);
1474 @ <p>Allow "unsafe" HTML (ex: &lt;script&gt;, &lt;form&gt;, etc) to be
1475 @ generated by <a href="%R/md_rules">Markdown-formatted</a> documents.
1476
1477 DDED src/wiki-rules.txt
--- src/setup.c
+++ src/setup.c
@@ -988,16 +988,10 @@
988 "1", "HH:MM:SS",
989 "2", "YYYY-MM-DD HH:MM",
990 "3", "YYMMDD HH:MM",
991 "4", "(off)"
992 };
 
 
 
 
 
 
993 login_check_credentials();
994 if( !g.perm.Admin ){
995 login_needed(0);
996 return;
997 }
@@ -1014,24 +1008,10 @@
1008 "timeline-block-markup", "tbm", 0, 0);
1009 @ <p>In timeline displays, check-in comments can be displayed with or
1010 @ without block markup such as paragraphs, tables, etc.
1011 @ (Property: "timeline-block-markup")</p>
1012
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1013 @ <hr>
1014 onoff_attribute("Plaintext comments on timelines",
1015 "timeline-plaintext", "tpt", 0, 0);
1016 @ <p>In timeline displays, check-in comments are displayed literally,
1017 @ without any wiki or HTML interpretation. This setting takes priority
@@ -1452,12 +1432,12 @@
1432 db_begin_transaction();
1433 @ <form action="%R/setup_wiki" method="post"><div>
1434 login_insert_csrf_secret();
1435 @ <input type="submit" name="submit" value="Apply Changes"></p>
1436 @ <hr>
1437 onoff_attribute("Associate Wiki Pages With Branches, Tags, Tickets,"
1438 " or Checkins", "wiki-about", "wiki-about", 1, 0);
1439 @ <p>
1440 @ Associate wiki pages with branches, tags, tickets, or checkins, based on
1441 @ the wiki page name. Wiki pages that begin with "branch/", "checkin/",
1442 @ "tag/" or "ticket" and which continue with the name of an existing branch,
1443 @ check-in, tag or ticket are treated specially when this feature is enabled.
@@ -1466,10 +1446,32 @@
1446 @ <li> <b>checkin/</b><i>full-check-in-hash</i>
1447 @ <li> <b>tag/</b><i>tag-name</i>
1448 @ <li> <b>ticket/</b><i>full-ticket-hash</i>
1449 @ </ul>
1450 @ (Property: "wiki-about")</p>
1451 @ <hr>
1452 onoff_attribute("Disable the 2025 enhancements to wiki formatting rules",
1453 "wiki-classic", "wiki-classic", 0, 0);
1454 @ <p>When enabled, only the original circa-2007 wiki formatting rules are
1455 @ recognized. The new formatting rules added in 2025 are ignored. Enable
1456 @ this setting if you are hosting an older repository that has preexisting
1457 @ wiki content that is adversely affected by the new rules.
1458 @ The enhanced wiki formatting rules added in 2025 are:
1459 @ <ul>
1460 @ <li> Markdown-style hyperlinks:&emsp;\
1461 @ <tt>[display](URL)</tt>
1462 @ <li> Angle-bracket hyperlinks:&emsp; <tt>&lt;URL&gt;</tt>
1463 @ <li> Font changes:&emsp;
1464 @ <tt>*italic*</tt> &emsp;\
1465 @ <tt>**bold**</tt> &emsp;\
1466 @ <tt>`teletype`</tt>
1467 @ <li> Backslash escapes:&emsp;\
1468 @ <tt>\&gt;</tt> &ensp; <tt>\[</tt> &ensp; <tt>\*</tt> &ensp;
1469 @ <tt>\_</tt> &ensp; <tt>\'</tt> &ensp; <tt>\\</tt> &emsp;
1470 @ <i>and so forth...</i>
1471 @ </ul>
1472 @ (Property: "wiki-classic")
1473 @ <hr>
1474 entry_attribute("Allow Unsafe HTML In Markdown", 6,
1475 "safe-html", "safe-html", "", 0);
1476 @ <p>Allow "unsafe" HTML (ex: &lt;script&gt;, &lt;form&gt;, etc) to be
1477 @ generated by <a href="%R/md_rules">Markdown-formatted</a> documents.
1478
1479 DDED src/wiki-rules.txt
+123 -8
--- a/src/wiki-rules.txt
+++ b/src/wiki-rules.txt
@@ -1,10 +1,125 @@
11
<h2>Wiki Formatting Rule Summary</h2>
22
3
- # Blank lines are paragraph breaks
4
- # Bullets are "*" surrounded by two spaces at the beginning of a line
5
- # Enumeration items are "#" or a digit and a "." surrounded by two
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>lab or "<b>&lt
3
+<ol>
4
+<li> Blank lines are paragraph breaks
5
+<li> Bullets are "*" surrounded by two spaces at the beginning of a line
6
+<li> Enumeration items are "#" or a digit and a "." surrounded by two
7
+ spaces at the beginning of a line
8
+<li> Indented paragraphs begin with a tab or two spaces
9
+<li> Hyperlinks in square brackets:
10
+ "<b>[</b><i>target</i><b>]</b>"
11
+ or "<b>[</b><i>target</i><b>|</b><i>label</i><b>]</b>"
12
+ or "<b>&lt;</b><i>URL</i><b>&gt;</b>"
13
++<li> Hyperlinks in angle brackets: "<b>&lt;</b><i>URL</i><b>&gt;</b>"
14
++<li> Markdown-style hyperlinks:
15
++ "<b>&#91;</b><i>label</i><b>&#93;(</b><i>target</i><b>)</b>"
16
+<li> Most ordinary HTML works
17
++<li> Fonts: "<b>*</b><i>italic</i><b>*</b>",
18
++ "<b>**</b><i>bold</i><b>**</b>",
19
++ "<b>`</b><i>teletype</i><b>`</b>".
20
++<li> Backslash escapes: <b>\&lt;&ensp;\&#91&ensp;\*&ensp;\_&ensp;
21
++ \&gt;&ensp;\\</b>&ensp;<i>and so forth....</i>
22
+<li> &lt;verbatim&gt; and &lt;nowiki&gt;
23
+</ol>
24
+
25
+<h2>Formatting Rule Details</h2>
26
+
27
+<ol>
28
+<li> <p><b>Paragraphs.</b>
29
+ Any sequence of one or more blank lines forms a paragraph break.
30
+ Centered or right-justified paragraphs are not supported by wiki markup,
31
+ but you can do these things if you need them using HTML.
32
+
33
+<li> <p><b>Bullet Lists.</b>
34
+ A bullet list item is a line that begins with a single "*" character
35
+ surrounded on both sides by two or more spaces or by a tab.
36
+ Only a single level of bullet list is supported by wiki.
37
+ For nested lists, use HTML.
38
+
39
+<li> <p><b>Enumeration Lists.</b>
40
+ An enumeration list item is a line that begins with a single "#"
41
+ character surrounded on both sides by two or more spaces or by a tab.
42
+ Or it can be a number and a "." (ex: "5.") surrounded on both sides
43
+ by two spaces or a tab.
44
+ Only a single level of enumeration list is supported by wiki.
45
+ For nested lists or for enumerations that count using letters or
46
+ roman numerals, use HTML.
47
+
48
+<li> <p><b>Indented Paragraphs.</b>
49
+ Any paragraph that begins with two or more spaces or a tab and which
50
+ is not a bullet or enumeration list item is rendered indented.
51
+ Only a single level of indentation is supported by wiki.
52
+ Use HTML for deeper indentation.
53
+
54
+<li> <p><b>Hyperlinks.</b>
55
+ Text within square brackets ("[...]") becomes a
56
+ hyperlink. The target can be a wiki page name, the artifact ID of
57
+ a check-in or ticket, the name of an image, a URL, or an
58
+ [#intermap|interwiki link] of the form
59
+ "<i>Tag</i><b>:</b><i>PageName</i>".
60
+ By default, the target is displayed as the text of the hyperlink.
61
+ But you can specify alternative text after the target name
62
+ separated by a "|" character.
63
+ You can also link to internal anchor names using
64
+ [#anchor-name], providing you have added the necessary
65
+ "&lt;a name='anchor-name'&gt;&lt;/a&gt;" tag to your wiki page.
66
+
67
++<li> <p><b>Auto-links</b>
68
++ A URL that begins with "http://" or "https://" and that is
69
++ enclosed in &lt;...&gt; functions as a hyperlink.
70
++
71
++
72
++<li> <p><b>Markdown-style hyperlinks</b>
73
++ Links of the form
74
++ "<b>[</b><i>display-text</i><b>](</b><i>target</i><b>)</b>"
75
++ show "<i>display-text</i>" on screen and make it a hyperlin
76
++ to "<i>target</i>".
77
+
78
+<li> <p><b>HTML.</b>
79
+ The following standard HTML elements may be used:
80
+ &lt;a&gt; &lt;address&gt; &lt;article&gt; &lt;aside&gt; &lt;b&gt;
81
+ &lt;big&gt; &lt;blockquote&gt; &lt;br&gt; &lt;center&gt; &lt;cite&gt;
82
+ &lt;code&gt; &lt;col&gt; &lt;colgroup&gt; &lt;dd&gt;
83
+ &lt;del&gt; &lt;dfn&gt;
84
+ &lt;div&gt; &lt;dl&gt; &lt;dt&gt; &lt;em&gt; &lt;font&gt; &lt;footer&gt;
85
+ &lt;ins&gt;
86
+ &lt;h1&gt; &lt;h2&gt; &lt;h3&gt; &lt;h4&gt; &lt;h5&gt; &lt;h6&gt;
87
+ &lt;header&gt; &lt;hr&gt; &lt;i&gt; &lt;img&gt; &lt;kbd&gt; &lt;li&gt;
88
+ &lt;nav&gt; &lt;nobr&gt; &lt;nowiki&gt; &lt;ol&gt; &lt;p&gt; &lt;pre&gt;
89
+ &lt;s&gt; &lt;samp&gt; &lt;section&gt; &lt;small&gt; &lt;span&gt;
90
+ &lt;strike&gt; &lt;strong&gt; &lt;sub&gt; &lt;sup&gt; &lt;table&gt;
91
+ &lt;tbody&gt; &lt;td&gt; &lt;tfoot&gt; &lt;th&gt; &lt;thead&gt;
92
+ &lt;title&gt; &lt;tr&gt; &lt;tt&gt; &lt;u&gt; &lt;ul&gt; &lt;var&gt;
93
+ &lt;verbatim&gt;. There are two non-standard elements available:
94
+ &lt;verbatim&gt; and &lt;nowiki&gt;. No other elements are allowed.
95
+ All attributes are checked and only a few benign attributes are
96
+ allowed on each element. In particular, any attributes that specify
97
+ javascript or CSS are elided.
98
+
99
++<li> <p><b>Font Markup.</b>
100
++ Text enclosed within "<tt>*...*</tt>" or "<tt>_..._</tt>" is
101
++ emphasized (italic font). Text within "<tt>**...**</tt>" or
102
++ "<tt>__...__</tt>" gets strong emphasis (bold font).
103
++ Text within "<tt>`...`</tt>" is rendered literally using a
104
++ constant-width font. Special characters (ex: "&lt" or "[") within
105
++ "<tt>`...`</tt>" lose their special meaning and are rendered
106
++ literally.
107
++
108
++<li> <p><b>Backslash escapes.</b>
109
++ A backslash followed by any other character is rendered as just
110
++ the other character. The character that follows the backslash
111
++ loses any special meaning it might have had otherwise. This is
112
++ useful for escaping markup for literal display.
113
+
114
+<li> <p><b>Special Markup.</b>
115
+ The &lt;nowiki&gt; tag disables all wiki formatting rules through
116
+ the matching &lt;/nowiki&gt; element. The &lt;verbatim&gt; tag works
117
+ like &lt;pre&gt; with the addition that it also disables all wiki
118
+ and HTML markup through the matching &lt;/verbatim&gt;.
119
+ Text within
120
+ <tt>&lt;verbatim&nbsp;type="pikchr"&gt;...&lt;/verbatim&gt;</tt>
121
+ is formatted using <a href="https://pikchr.org/home">Pikchr</a>.
122
+</ol>
123
+
124
+<a name="intermap"></a>
125
+<h2>Interwiki Tag [/intermap|Map]</h2>
--- a/src/wiki-rules.txt
+++ b/src/wiki-rules.txt
@@ -1,10 +1,125 @@
1 <h2>Wiki Formatting Rule Summary</h2>
2
3 # Blank lines are paragraph breaks
4 # Bullets are "*" surrounded by two spaces at the beginning of a line
5 # Enumeration items are "#" or a digit and a "." surrounded by two
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>lab or "<b>&lt
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/src/wiki-rules.txt
+++ b/src/wiki-rules.txt
@@ -1,10 +1,125 @@
1 <h2>Wiki Formatting Rule Summary</h2>
2
3 <ol>
4 <li> Blank lines are paragraph breaks
5 <li> Bullets are "*" surrounded by two spaces at the beginning of a line
6 <li> Enumeration items are "#" or a digit and a "." surrounded by two
7 spaces at the beginning of a line
8 <li> Indented paragraphs begin with a tab or two spaces
9 <li> Hyperlinks in square brackets:
10 "<b>[</b><i>target</i><b>]</b>"
11 or "<b>[</b><i>target</i><b>|</b><i>label</i><b>]</b>"
12 or "<b>&lt;</b><i>URL</i><b>&gt;</b>"
13 +<li> Hyperlinks in angle brackets: "<b>&lt;</b><i>URL</i><b>&gt;</b>"
14 +<li> Markdown-style hyperlinks:
15 + "<b>&#91;</b><i>label</i><b>&#93;(</b><i>target</i><b>)</b>"
16 <li> Most ordinary HTML works
17 +<li> Fonts: "<b>*</b><i>italic</i><b>*</b>",
18 + "<b>**</b><i>bold</i><b>**</b>",
19 + "<b>`</b><i>teletype</i><b>`</b>".
20 +<li> Backslash escapes: <b>\&lt;&ensp;\&#91&ensp;\*&ensp;\_&ensp;
21 + \&gt;&ensp;\\</b>&ensp;<i>and so forth....</i>
22 <li> &lt;verbatim&gt; and &lt;nowiki&gt;
23 </ol>
24
25 <h2>Formatting Rule Details</h2>
26
27 <ol>
28 <li> <p><b>Paragraphs.</b>
29 Any sequence of one or more blank lines forms a paragraph break.
30 Centered or right-justified paragraphs are not supported by wiki markup,
31 but you can do these things if you need them using HTML.
32
33 <li> <p><b>Bullet Lists.</b>
34 A bullet list item is a line that begins with a single "*" character
35 surrounded on both sides by two or more spaces or by a tab.
36 Only a single level of bullet list is supported by wiki.
37 For nested lists, use HTML.
38
39 <li> <p><b>Enumeration Lists.</b>
40 An enumeration list item is a line that begins with a single "#"
41 character surrounded on both sides by two or more spaces or by a tab.
42 Or it can be a number and a "." (ex: "5.") surrounded on both sides
43 by two spaces or a tab.
44 Only a single level of enumeration list is supported by wiki.
45 For nested lists or for enumerations that count using letters or
46 roman numerals, use HTML.
47
48 <li> <p><b>Indented Paragraphs.</b>
49 Any paragraph that begins with two or more spaces or a tab and which
50 is not a bullet or enumeration list item is rendered indented.
51 Only a single level of indentation is supported by wiki.
52 Use HTML for deeper indentation.
53
54 <li> <p><b>Hyperlinks.</b>
55 Text within square brackets ("[...]") becomes a
56 hyperlink. The target can be a wiki page name, the artifact ID of
57 a check-in or ticket, the name of an image, a URL, or an
58 [#intermap|interwiki link] of the form
59 "<i>Tag</i><b>:</b><i>PageName</i>".
60 By default, the target is displayed as the text of the hyperlink.
61 But you can specify alternative text after the target name
62 separated by a "|" character.
63 You can also link to internal anchor names using
64 [#anchor-name], providing you have added the necessary
65 "&lt;a name='anchor-name'&gt;&lt;/a&gt;" tag to your wiki page.
66
67 +<li> <p><b>Auto-links</b>
68 + A URL that begins with "http://" or "https://" and that is
69 + enclosed in &lt;...&gt; functions as a hyperlink.
70 +
71 +
72 +<li> <p><b>Markdown-style hyperlinks</b>
73 + Links of the form
74 + "<b>[</b><i>display-text</i><b>](</b><i>target</i><b>)</b>"
75 + show "<i>display-text</i>" on screen and make it a hyperlin
76 + to "<i>target</i>".
77
78 <li> <p><b>HTML.</b>
79 The following standard HTML elements may be used:
80 &lt;a&gt; &lt;address&gt; &lt;article&gt; &lt;aside&gt; &lt;b&gt;
81 &lt;big&gt; &lt;blockquote&gt; &lt;br&gt; &lt;center&gt; &lt;cite&gt;
82 &lt;code&gt; &lt;col&gt; &lt;colgroup&gt; &lt;dd&gt;
83 &lt;del&gt; &lt;dfn&gt;
84 &lt;div&gt; &lt;dl&gt; &lt;dt&gt; &lt;em&gt; &lt;font&gt; &lt;footer&gt;
85 &lt;ins&gt;
86 &lt;h1&gt; &lt;h2&gt; &lt;h3&gt; &lt;h4&gt; &lt;h5&gt; &lt;h6&gt;
87 &lt;header&gt; &lt;hr&gt; &lt;i&gt; &lt;img&gt; &lt;kbd&gt; &lt;li&gt;
88 &lt;nav&gt; &lt;nobr&gt; &lt;nowiki&gt; &lt;ol&gt; &lt;p&gt; &lt;pre&gt;
89 &lt;s&gt; &lt;samp&gt; &lt;section&gt; &lt;small&gt; &lt;span&gt;
90 &lt;strike&gt; &lt;strong&gt; &lt;sub&gt; &lt;sup&gt; &lt;table&gt;
91 &lt;tbody&gt; &lt;td&gt; &lt;tfoot&gt; &lt;th&gt; &lt;thead&gt;
92 &lt;title&gt; &lt;tr&gt; &lt;tt&gt; &lt;u&gt; &lt;ul&gt; &lt;var&gt;
93 &lt;verbatim&gt;. There are two non-standard elements available:
94 &lt;verbatim&gt; and &lt;nowiki&gt;. No other elements are allowed.
95 All attributes are checked and only a few benign attributes are
96 allowed on each element. In particular, any attributes that specify
97 javascript or CSS are elided.
98
99 +<li> <p><b>Font Markup.</b>
100 + Text enclosed within "<tt>*...*</tt>" or "<tt>_..._</tt>" is
101 + emphasized (italic font). Text within "<tt>**...**</tt>" or
102 + "<tt>__...__</tt>" gets strong emphasis (bold font).
103 + Text within "<tt>`...`</tt>" is rendered literally using a
104 + constant-width font. Special characters (ex: "&lt" or "[") within
105 + "<tt>`...`</tt>" lose their special meaning and are rendered
106 + literally.
107 +
108 +<li> <p><b>Backslash escapes.</b>
109 + A backslash followed by any other character is rendered as just
110 + the other character. The character that follows the backslash
111 + loses any special meaning it might have had otherwise. This is
112 + useful for escaping markup for literal display.
113
114 <li> <p><b>Special Markup.</b>
115 The &lt;nowiki&gt; tag disables all wiki formatting rules through
116 the matching &lt;/nowiki&gt; element. The &lt;verbatim&gt; tag works
117 like &lt;pre&gt; with the addition that it also disables all wiki
118 and HTML markup through the matching &lt;/verbatim&gt;.
119 Text within
120 <tt>&lt;verbatim&nbsp;type="pikchr"&gt;...&lt;/verbatim&gt;</tt>
121 is formatted using <a href="https://pikchr.org/home">Pikchr</a>.
122 </ol>
123
124 <a name="intermap"></a>
125 <h2>Interwiki Tag [/intermap|Map]</h2>
+39 -12
--- src/wiki.c
+++ src/wiki.c
@@ -264,26 +264,53 @@
264264
** WEBPAGE: wiki_rules
265265
**
266266
** Show a summary of the wiki formatting rules.
267267
*/
268268
void wiki_rules_page(void){
269
- Blob x;
270
- int fTxt = P("txt")!=0;
269
+ Blob x, y, line;
270
+ int bClDflt = db_get_boolean("wiki-classic",0);
271
+ int bClassic;
272
+ if( P("classic")!=0 ){
273
+ bClassic = 1;
274
+ }else if( P("enhanced")!=0 ){
275
+ bClassic = 0;
276
+ }else{
277
+ bClassic = bClDflt;
278
+ }
271279
style_set_current_feature("wiki");
272280
style_header("Wiki Formatting Rules");
273
- if( fTxt ){
274
- style_submenu_element("Formatted", "%R/wiki_rules");
281
+ style_submenu_element("Markdown","%R/md_rules");
282
+ if( bClassic ){
283
+ style_submenu_element("Enhanced-Wiki","%R/wiki_rules?enhanced");
275284
}else{
276
- style_submenu_element("Plain-Text", "%R/wiki_rules?txt=1");
277
- }
278
- style_submenu_element("Markdown","%R/md_rules");
279
- blob_init(&x, builtin_text("wiki.wiki"), -1);
280
- blob_materialize(&x);
281
- interwiki_append_map_table(&x);
282
- safe_html_context(DOCSRC_TRUSTED);
283
- wiki_render_by_mimetype(&x, fTxt ? "text/plain" : "text/x-fossil-wiki");
285
+ style_submenu_element("Classic-Wiki","%R/wiki_rules?classic");
286
+ }
287
+ if( bClassic && !bClDflt ){
288
+ @ <p>NOTE: This repository is set to render wiki text using the
289
+ @ <a href="%R/wiki_rules">Enhanced Wiki Rules</a>. The following
290
+ @ describes the Classic Wiki Rules where are a subset of the
291
+ @ enhanced rules.
292
+ }else if( !bClassic && bClDflt ){
293
+ @ <p>NOTE: This repository is set to render wiki text using the
294
+ @ <a href="%R/wiki_rules">Classic Wiki Rules</a>. The following
295
+ @ describes the Enhanced Wiki Rules where are a subset of the
296
+ @ classic rules.
297
+ }
298
+ blob_init(&x, builtin_text("wiki-rules.txt"), -1);
299
+ blob_init(&y, 0, 0);
300
+ while( blob_line(&x, &line) ){
301
+ if( blob_buffer(&line)[0]!='+' ){
302
+ blob_append(&y, blob_buffer(&line), blob_size(&line));
303
+ }else if( !bClassic ){
304
+ blob_append(&y, blob_buffer(&line)+1, blob_size(&line)-1);
305
+ }
306
+ }
284307
blob_reset(&x);
308
+ blob_reset(&line);
309
+ interwiki_append_map_table(&y);
310
+ cgi_append_content(blob_buffer(&y), blob_size(&y));
311
+ blob_reset(&y);
285312
style_finish_page();
286313
}
287314
288315
/*
289316
** WEBPAGE: markup_help
290317
291318
DELETED src/wiki.wiki
--- src/wiki.c
+++ src/wiki.c
@@ -264,26 +264,53 @@
264 ** WEBPAGE: wiki_rules
265 **
266 ** Show a summary of the wiki formatting rules.
267 */
268 void wiki_rules_page(void){
269 Blob x;
270 int fTxt = P("txt")!=0;
 
 
 
 
 
 
 
 
271 style_set_current_feature("wiki");
272 style_header("Wiki Formatting Rules");
273 if( fTxt ){
274 style_submenu_element("Formatted", "%R/wiki_rules");
 
275 }else{
276 style_submenu_element("Plain-Text", "%R/wiki_rules?txt=1");
277 }
278 style_submenu_element("Markdown","%R/md_rules");
279 blob_init(&x, builtin_text("wiki.wiki"), -1);
280 blob_materialize(&x);
281 interwiki_append_map_table(&x);
282 safe_html_context(DOCSRC_TRUSTED);
283 wiki_render_by_mimetype(&x, fTxt ? "text/plain" : "text/x-fossil-wiki");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
284 blob_reset(&x);
 
 
 
 
285 style_finish_page();
286 }
287
288 /*
289 ** WEBPAGE: markup_help
290
291 ELETED src/wiki.wiki
--- src/wiki.c
+++ src/wiki.c
@@ -264,26 +264,53 @@
264 ** WEBPAGE: wiki_rules
265 **
266 ** Show a summary of the wiki formatting rules.
267 */
268 void wiki_rules_page(void){
269 Blob x, y, line;
270 int bClDflt = db_get_boolean("wiki-classic",0);
271 int bClassic;
272 if( P("classic")!=0 ){
273 bClassic = 1;
274 }else if( P("enhanced")!=0 ){
275 bClassic = 0;
276 }else{
277 bClassic = bClDflt;
278 }
279 style_set_current_feature("wiki");
280 style_header("Wiki Formatting Rules");
281 style_submenu_element("Markdown","%R/md_rules");
282 if( bClassic ){
283 style_submenu_element("Enhanced-Wiki","%R/wiki_rules?enhanced");
284 }else{
285 style_submenu_element("Classic-Wiki","%R/wiki_rules?classic");
286 }
287 if( bClassic && !bClDflt ){
288 @ <p>NOTE: This repository is set to render wiki text using the
289 @ <a href="%R/wiki_rules">Enhanced Wiki Rules</a>. The following
290 @ describes the Classic Wiki Rules where are a subset of the
291 @ enhanced rules.
292 }else if( !bClassic && bClDflt ){
293 @ <p>NOTE: This repository is set to render wiki text using the
294 @ <a href="%R/wiki_rules">Classic Wiki Rules</a>. The following
295 @ describes the Enhanced Wiki Rules where are a subset of the
296 @ classic rules.
297 }
298 blob_init(&x, builtin_text("wiki-rules.txt"), -1);
299 blob_init(&y, 0, 0);
300 while( blob_line(&x, &line) ){
301 if( blob_buffer(&line)[0]!='+' ){
302 blob_append(&y, blob_buffer(&line), blob_size(&line));
303 }else if( !bClassic ){
304 blob_append(&y, blob_buffer(&line)+1, blob_size(&line)-1);
305 }
306 }
307 blob_reset(&x);
308 blob_reset(&line);
309 interwiki_append_map_table(&y);
310 cgi_append_content(blob_buffer(&y), blob_size(&y));
311 blob_reset(&y);
312 style_finish_page();
313 }
314
315 /*
316 ** WEBPAGE: markup_help
317
318 ELETED src/wiki.wiki
D src/wiki.wiki
-10
--- a/src/wiki.wiki
+++ b/src/wiki.wiki
@@ -1,10 +0,0 @@
1
-<h2>Wiki Formatting Rule Summary</h2>
2
-
3
- # Blank lines are paragraph breaks
4
- # Bullets are "*" surrounded by two spaces at the beginning of a line
5
- # Enumeration items are "#" or a digit and a "." surrounded by two
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>lab or "<b>&lt
--- a/src/wiki.wiki
+++ b/src/wiki.wiki
@@ -1,10 +0,0 @@
1 <h2>Wiki Formatting Rule Summary</h2>
2
3 # Blank lines are paragraph breaks
4 # Bullets are "*" surrounded by two spaces at the beginning of a line
5 # Enumeration items are "#" or a digit and a "." surrounded by two
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>lab or "<b>&lt
--- a/src/wiki.wiki
+++ b/src/wiki.wiki
@@ -1,10 +0,0 @@
 
 
 
 
 
 
 
 
 
 
+61 -18
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -500,10 +500,23 @@
500500
short allowWiki; /* ALLOW_WIKI if wiki allowed before tag */
501501
const char *zId; /* ID attribute or NULL */
502502
} *aStack;
503503
};
504504
505
+
506
+/*
507
+** SETTING: wiki-use-html boolean default=off
508
+**
509
+** If enabled, recognize only HTML in Fossil Wiki text. Other wiki markup
510
+** is ignored. In other words, this setting make HTML the wiki markup
511
+** language.
512
+**
513
+** CAUTION: When enabled, this setting allows *all* HTML text through,
514
+** unsanitized. Only use this setting in closed environments where all
515
+** inputs are from trusted users, as the ability to inject arbitrary
516
+** HTML can be misused by rapscallions.
517
+*/
505518
/*
506519
** Return TRUE if HTML should be used as the sole markup language for wiki.
507520
**
508521
** On first invocation, this routine consults the "wiki-use-html" setting.
509522
** It caches the result for subsequent invocations, under the assumption
@@ -512,10 +525,37 @@
512525
static int wikiUsesHtml(void){
513526
static int r = -1;
514527
if( r<0 ) r = db_get_boolean("wiki-use-html", 0);
515528
return r;
516529
}
530
+
531
+/*
532
+** SETTING: wiki-classic boolean default=off
533
+**
534
+** When enabled, this setting causes Fossil Wiki text to be rendered
535
+** in the original circa-2007 style which omits the enhancements added
536
+** in 2025. Enable this setting if you have an older repository with
537
+** a lot of wiki-formatted text that does not render well using the
538
+** new enhancements.
539
+**
540
+** The specific wiki formatting enhancements that are disabled when
541
+** then setting is turned on are:
542
+**
543
+** * Markdown hyperlinks: [display-text](URL)
544
+** * Bracket hyperlinks: <URL>
545
+** * Font changes: *italic* **bold** `teletype`
546
+** * Backslash escapes: \\< \\[ \\* \\' \\_ \\\\ and so forth
547
+*/
548
+/*
549
+** Return TRUE limit wiki formatting to the classic circa-2007 style
550
+** and omit the 2025 enhancements.
551
+*/
552
+static int wikiClassic(void){
553
+ static int r = -1;
554
+ if( r<0 ) r = db_get_boolean("wiki-classic", 0);
555
+ return r;
556
+}
517557
518558
/*
519559
** z points to a "<" character. Check to see if this is the start of
520560
** a valid markup. If it is, return the total number of characters in
521561
** the markup including the initial "<" and the terminating ">". If
@@ -2066,10 +2106,17 @@
20662106
Renderer renderer;
20672107
20682108
memset(&renderer, 0, sizeof(renderer));
20692109
renderer.renderFlags = flags;
20702110
renderer.state = ALLOW_WIKI|AT_NEWLINE|AT_PARAGRAPH|flags;
2111
+ if( (flags & WIKI_OVERRIDE)==0 ){
2112
+ if( wikiClassic() ){
2113
+ renderer.state &= ~(WIKI_MARKDOWN_INLINE);
2114
+ }else{
2115
+ renderer.state |= WIKI_MARKDOWN_INLINE;
2116
+ }
2117
+ }
20712118
if( flags & WIKI_INLINE ){
20722119
renderer.wantAutoParagraph = 0;
20732120
}else{
20742121
renderer.wantAutoParagraph = 1;
20752122
}
@@ -2133,12 +2180,14 @@
21332180
**
21342181
** Translate the input FILE from Fossil-wiki into HTML and write
21352182
** the resulting HTML on standard output.
21362183
**
21372184
** Options:
2138
-** --buttons Set the WIKI_BUTTONS flag
2185
+** --buttons Set the WIKI_BUTTONS flag
2186
+** --classic Use only classic wiki rules
21392187
** --dark-pikchr Render pikchrs in dark mode
2188
+** --enhanced Use 2025 enhanced wiki rules
21402189
** --htmlonly Set the WIKI_HTMLONLY flag
21412190
** --inline Set the WIKI_INLINE flag
21422191
** --linksonly Set the WIKI_LINKSONLY flag
21432192
** --markdown Allow all in-line markdown syntax
21442193
** --markdown-link Allow markdown hyperlink syntax
@@ -2151,10 +2200,17 @@
21512200
void test_wiki_render(void){
21522201
Blob in, out;
21532202
int flags = ALLOW_LINKS;
21542203
int bText, bTokenize;
21552204
if( find_option("buttons",0,0)!=0 ) flags |= WIKI_BUTTONS;
2205
+ if( find_option("classic",0,0)!=0 ){
2206
+ flags |= WIKI_OVERRIDE;
2207
+ flags &= ~(WIKI_MARKDOWN_INLINE);
2208
+ }
2209
+ if( find_option("enhanced",0,0)!=0 ){
2210
+ flags |= WIKI_OVERRIDE|WIKI_MARKDOWN_INLINE;
2211
+ }
21562212
if( find_option("htmlonly",0,0)!=0 ) flags |= WIKI_HTMLONLY;
21572213
if( find_option("linksonly",0,0)!=0 ) flags |= WIKI_LINKSONLY;
21582214
if( find_option("nobadlinks",0,0)!=0 ) flags |= WIKI_NOBADLINKS;
21592215
if( find_option("inline",0,0)!=0 ) flags |= WIKI_INLINE;
21602216
if( find_option("noblock",0,0)!=0 ) flags |= WIKI_NOBLOCK;
@@ -2281,10 +2337,11 @@
22812337
/*
22822338
** Parse text looking for wiki hyperlinks in one of the formats:
22832339
**
22842340
** [target]
22852341
** [target|...]
2342
+** [display](target)
22862343
**
22872344
** Where "target" can be either an artifact ID prefix or a wiki page
22882345
** name. For each such hyperlink found, add an entry to the
22892346
** backlink table.
22902347
*/
@@ -2295,30 +2352,16 @@
22952352
){
22962353
Renderer renderer;
22972354
int tokenType;
22982355
ParsedMarkup markup;
22992356
int n;
2300
- int inlineOnly;
2301
- int wikiHtmlOnly = 0;
23022357
23032358
memset(&renderer, 0, sizeof(renderer));
2304
- renderer.state = ALLOW_WIKI|AT_NEWLINE|AT_PARAGRAPH;
2305
- if( flags & WIKI_NOBLOCK ){
2306
- renderer.state |= INLINE_MARKUP_ONLY;
2307
- }
2308
- if( wikiUsesHtml() ){
2309
- renderer.state |= WIKI_HTMLONLY;
2310
- wikiHtmlOnly = 1;
2311
- }
2312
- inlineOnly = (renderer.state & INLINE_MARKUP_ONLY)!=0;
2359
+ renderer.state = ALLOW_WIKI;
23132360
23142361
while( z[0] ){
2315
- if( wikiHtmlOnly ){
2316
- n = nextRawToken(z, &renderer, &tokenType);
2317
- }else{
2318
- n = nextWikiToken(z, &renderer, &tokenType);
2319
- }
2362
+ n = nextWikiToken(z, &renderer, &tokenType);
23202363
switch( tokenType ){
23212364
case TOKEN_LINK: {
23222365
char *zTarget, *zEnd;
23232366
int i;
23242367
@@ -2402,11 +2445,11 @@
24022445
}
24032446
}else
24042447
24052448
/* Ignore block markup for in-line rendering.
24062449
*/
2407
- if( inlineOnly && (markup.iType&MUTYPE_INLINE)==0 ){
2450
+ if( (markup.iType & MUTYPE_INLINE)==0 ){
24082451
/* Do nothing */
24092452
}else
24102453
24112454
/* Generate end-tags */
24122455
if( markup.endTag ){
24132456
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -500,10 +500,23 @@
500 short allowWiki; /* ALLOW_WIKI if wiki allowed before tag */
501 const char *zId; /* ID attribute or NULL */
502 } *aStack;
503 };
504
 
 
 
 
 
 
 
 
 
 
 
 
 
505 /*
506 ** Return TRUE if HTML should be used as the sole markup language for wiki.
507 **
508 ** On first invocation, this routine consults the "wiki-use-html" setting.
509 ** It caches the result for subsequent invocations, under the assumption
@@ -512,10 +525,37 @@
512 static int wikiUsesHtml(void){
513 static int r = -1;
514 if( r<0 ) r = db_get_boolean("wiki-use-html", 0);
515 return r;
516 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
517
518 /*
519 ** z points to a "<" character. Check to see if this is the start of
520 ** a valid markup. If it is, return the total number of characters in
521 ** the markup including the initial "<" and the terminating ">". If
@@ -2066,10 +2106,17 @@
2066 Renderer renderer;
2067
2068 memset(&renderer, 0, sizeof(renderer));
2069 renderer.renderFlags = flags;
2070 renderer.state = ALLOW_WIKI|AT_NEWLINE|AT_PARAGRAPH|flags;
 
 
 
 
 
 
 
2071 if( flags & WIKI_INLINE ){
2072 renderer.wantAutoParagraph = 0;
2073 }else{
2074 renderer.wantAutoParagraph = 1;
2075 }
@@ -2133,12 +2180,14 @@
2133 **
2134 ** Translate the input FILE from Fossil-wiki into HTML and write
2135 ** the resulting HTML on standard output.
2136 **
2137 ** Options:
2138 ** --buttons Set the WIKI_BUTTONS flag
 
2139 ** --dark-pikchr Render pikchrs in dark mode
 
2140 ** --htmlonly Set the WIKI_HTMLONLY flag
2141 ** --inline Set the WIKI_INLINE flag
2142 ** --linksonly Set the WIKI_LINKSONLY flag
2143 ** --markdown Allow all in-line markdown syntax
2144 ** --markdown-link Allow markdown hyperlink syntax
@@ -2151,10 +2200,17 @@
2151 void test_wiki_render(void){
2152 Blob in, out;
2153 int flags = ALLOW_LINKS;
2154 int bText, bTokenize;
2155 if( find_option("buttons",0,0)!=0 ) flags |= WIKI_BUTTONS;
 
 
 
 
 
 
 
2156 if( find_option("htmlonly",0,0)!=0 ) flags |= WIKI_HTMLONLY;
2157 if( find_option("linksonly",0,0)!=0 ) flags |= WIKI_LINKSONLY;
2158 if( find_option("nobadlinks",0,0)!=0 ) flags |= WIKI_NOBADLINKS;
2159 if( find_option("inline",0,0)!=0 ) flags |= WIKI_INLINE;
2160 if( find_option("noblock",0,0)!=0 ) flags |= WIKI_NOBLOCK;
@@ -2281,10 +2337,11 @@
2281 /*
2282 ** Parse text looking for wiki hyperlinks in one of the formats:
2283 **
2284 ** [target]
2285 ** [target|...]
 
2286 **
2287 ** Where "target" can be either an artifact ID prefix or a wiki page
2288 ** name. For each such hyperlink found, add an entry to the
2289 ** backlink table.
2290 */
@@ -2295,30 +2352,16 @@
2295 ){
2296 Renderer renderer;
2297 int tokenType;
2298 ParsedMarkup markup;
2299 int n;
2300 int inlineOnly;
2301 int wikiHtmlOnly = 0;
2302
2303 memset(&renderer, 0, sizeof(renderer));
2304 renderer.state = ALLOW_WIKI|AT_NEWLINE|AT_PARAGRAPH;
2305 if( flags & WIKI_NOBLOCK ){
2306 renderer.state |= INLINE_MARKUP_ONLY;
2307 }
2308 if( wikiUsesHtml() ){
2309 renderer.state |= WIKI_HTMLONLY;
2310 wikiHtmlOnly = 1;
2311 }
2312 inlineOnly = (renderer.state & INLINE_MARKUP_ONLY)!=0;
2313
2314 while( z[0] ){
2315 if( wikiHtmlOnly ){
2316 n = nextRawToken(z, &renderer, &tokenType);
2317 }else{
2318 n = nextWikiToken(z, &renderer, &tokenType);
2319 }
2320 switch( tokenType ){
2321 case TOKEN_LINK: {
2322 char *zTarget, *zEnd;
2323 int i;
2324
@@ -2402,11 +2445,11 @@
2402 }
2403 }else
2404
2405 /* Ignore block markup for in-line rendering.
2406 */
2407 if( inlineOnly && (markup.iType&MUTYPE_INLINE)==0 ){
2408 /* Do nothing */
2409 }else
2410
2411 /* Generate end-tags */
2412 if( markup.endTag ){
2413
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -500,10 +500,23 @@
500 short allowWiki; /* ALLOW_WIKI if wiki allowed before tag */
501 const char *zId; /* ID attribute or NULL */
502 } *aStack;
503 };
504
505
506 /*
507 ** SETTING: wiki-use-html boolean default=off
508 **
509 ** If enabled, recognize only HTML in Fossil Wiki text. Other wiki markup
510 ** is ignored. In other words, this setting make HTML the wiki markup
511 ** language.
512 **
513 ** CAUTION: When enabled, this setting allows *all* HTML text through,
514 ** unsanitized. Only use this setting in closed environments where all
515 ** inputs are from trusted users, as the ability to inject arbitrary
516 ** HTML can be misused by rapscallions.
517 */
518 /*
519 ** Return TRUE if HTML should be used as the sole markup language for wiki.
520 **
521 ** On first invocation, this routine consults the "wiki-use-html" setting.
522 ** It caches the result for subsequent invocations, under the assumption
@@ -512,10 +525,37 @@
525 static int wikiUsesHtml(void){
526 static int r = -1;
527 if( r<0 ) r = db_get_boolean("wiki-use-html", 0);
528 return r;
529 }
530
531 /*
532 ** SETTING: wiki-classic boolean default=off
533 **
534 ** When enabled, this setting causes Fossil Wiki text to be rendered
535 ** in the original circa-2007 style which omits the enhancements added
536 ** in 2025. Enable this setting if you have an older repository with
537 ** a lot of wiki-formatted text that does not render well using the
538 ** new enhancements.
539 **
540 ** The specific wiki formatting enhancements that are disabled when
541 ** then setting is turned on are:
542 **
543 ** * Markdown hyperlinks: [display-text](URL)
544 ** * Bracket hyperlinks: <URL>
545 ** * Font changes: *italic* **bold** `teletype`
546 ** * Backslash escapes: \\< \\[ \\* \\' \\_ \\\\ and so forth
547 */
548 /*
549 ** Return TRUE limit wiki formatting to the classic circa-2007 style
550 ** and omit the 2025 enhancements.
551 */
552 static int wikiClassic(void){
553 static int r = -1;
554 if( r<0 ) r = db_get_boolean("wiki-classic", 0);
555 return r;
556 }
557
558 /*
559 ** z points to a "<" character. Check to see if this is the start of
560 ** a valid markup. If it is, return the total number of characters in
561 ** the markup including the initial "<" and the terminating ">". If
@@ -2066,10 +2106,17 @@
2106 Renderer renderer;
2107
2108 memset(&renderer, 0, sizeof(renderer));
2109 renderer.renderFlags = flags;
2110 renderer.state = ALLOW_WIKI|AT_NEWLINE|AT_PARAGRAPH|flags;
2111 if( (flags & WIKI_OVERRIDE)==0 ){
2112 if( wikiClassic() ){
2113 renderer.state &= ~(WIKI_MARKDOWN_INLINE);
2114 }else{
2115 renderer.state |= WIKI_MARKDOWN_INLINE;
2116 }
2117 }
2118 if( flags & WIKI_INLINE ){
2119 renderer.wantAutoParagraph = 0;
2120 }else{
2121 renderer.wantAutoParagraph = 1;
2122 }
@@ -2133,12 +2180,14 @@
2180 **
2181 ** Translate the input FILE from Fossil-wiki into HTML and write
2182 ** the resulting HTML on standard output.
2183 **
2184 ** Options:
2185 ** --buttons Set the WIKI_BUTTONS flag
2186 ** --classic Use only classic wiki rules
2187 ** --dark-pikchr Render pikchrs in dark mode
2188 ** --enhanced Use 2025 enhanced wiki rules
2189 ** --htmlonly Set the WIKI_HTMLONLY flag
2190 ** --inline Set the WIKI_INLINE flag
2191 ** --linksonly Set the WIKI_LINKSONLY flag
2192 ** --markdown Allow all in-line markdown syntax
2193 ** --markdown-link Allow markdown hyperlink syntax
@@ -2151,10 +2200,17 @@
2200 void test_wiki_render(void){
2201 Blob in, out;
2202 int flags = ALLOW_LINKS;
2203 int bText, bTokenize;
2204 if( find_option("buttons",0,0)!=0 ) flags |= WIKI_BUTTONS;
2205 if( find_option("classic",0,0)!=0 ){
2206 flags |= WIKI_OVERRIDE;
2207 flags &= ~(WIKI_MARKDOWN_INLINE);
2208 }
2209 if( find_option("enhanced",0,0)!=0 ){
2210 flags |= WIKI_OVERRIDE|WIKI_MARKDOWN_INLINE;
2211 }
2212 if( find_option("htmlonly",0,0)!=0 ) flags |= WIKI_HTMLONLY;
2213 if( find_option("linksonly",0,0)!=0 ) flags |= WIKI_LINKSONLY;
2214 if( find_option("nobadlinks",0,0)!=0 ) flags |= WIKI_NOBADLINKS;
2215 if( find_option("inline",0,0)!=0 ) flags |= WIKI_INLINE;
2216 if( find_option("noblock",0,0)!=0 ) flags |= WIKI_NOBLOCK;
@@ -2281,10 +2337,11 @@
2337 /*
2338 ** Parse text looking for wiki hyperlinks in one of the formats:
2339 **
2340 ** [target]
2341 ** [target|...]
2342 ** [display](target)
2343 **
2344 ** Where "target" can be either an artifact ID prefix or a wiki page
2345 ** name. For each such hyperlink found, add an entry to the
2346 ** backlink table.
2347 */
@@ -2295,30 +2352,16 @@
2352 ){
2353 Renderer renderer;
2354 int tokenType;
2355 ParsedMarkup markup;
2356 int n;
 
 
2357
2358 memset(&renderer, 0, sizeof(renderer));
2359 renderer.state = ALLOW_WIKI;
 
 
 
 
 
 
 
 
2360
2361 while( z[0] ){
2362 n = nextWikiToken(z, &renderer, &tokenType);
 
 
 
 
2363 switch( tokenType ){
2364 case TOKEN_LINK: {
2365 char *zTarget, *zEnd;
2366 int i;
2367
@@ -2402,11 +2445,11 @@
2445 }
2446 }else
2447
2448 /* Ignore block markup for in-line rendering.
2449 */
2450 if( (markup.iType & MUTYPE_INLINE)==0 ){
2451 /* Do nothing */
2452 }else
2453
2454 /* Generate end-tags */
2455 if( markup.endTag ){
2456
--- tools/makemake.tcl
+++ tools/makemake.tcl
@@ -212,11 +212,11 @@
212212
# be relative to that.
213213
set extra_files {
214214
diff.tcl
215215
merge.tcl
216216
markdown.md
217
- wiki.wiki
217
+ wiki-rules.txt
218218
*.js
219219
default.css
220220
style.*.css
221221
../skins/*/*.txt
222222
sounds/*.wav
223223
--- tools/makemake.tcl
+++ tools/makemake.tcl
@@ -212,11 +212,11 @@
212 # be relative to that.
213 set extra_files {
214 diff.tcl
215 merge.tcl
216 markdown.md
217 wiki.wiki
218 *.js
219 default.css
220 style.*.css
221 ../skins/*/*.txt
222 sounds/*.wav
223
--- tools/makemake.tcl
+++ tools/makemake.tcl
@@ -212,11 +212,11 @@
212 # be relative to that.
213 set extra_files {
214 diff.tcl
215 merge.tcl
216 markdown.md
217 wiki-rules.txt
218 *.js
219 default.css
220 style.*.css
221 ../skins/*/*.txt
222 sounds/*.wav
223
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -663,11 +663,11 @@
663663
$(SRCDIR)/style.pikchrshow.css \
664664
$(SRCDIR)/style.uvlist.css \
665665
$(SRCDIR)/style.wikiedit.css \
666666
$(SRCDIR)/tree.js \
667667
$(SRCDIR)/useredit.js \
668
- $(SRCDIR)/wiki.wiki
668
+ $(SRCDIR)/wiki-rules.txt
669669
670670
TRANS_SRC = \
671671
$(OBJDIR)/add_.c \
672672
$(OBJDIR)/ajax_.c \
673673
$(OBJDIR)/alerts_.c \
674674
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -663,11 +663,11 @@
663 $(SRCDIR)/style.pikchrshow.css \
664 $(SRCDIR)/style.uvlist.css \
665 $(SRCDIR)/style.wikiedit.css \
666 $(SRCDIR)/tree.js \
667 $(SRCDIR)/useredit.js \
668 $(SRCDIR)/wiki.wiki
669
670 TRANS_SRC = \
671 $(OBJDIR)/add_.c \
672 $(OBJDIR)/ajax_.c \
673 $(OBJDIR)/alerts_.c \
674
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -663,11 +663,11 @@
663 $(SRCDIR)/style.pikchrshow.css \
664 $(SRCDIR)/style.uvlist.css \
665 $(SRCDIR)/style.wikiedit.css \
666 $(SRCDIR)/tree.js \
667 $(SRCDIR)/useredit.js \
668 $(SRCDIR)/wiki-rules.txt
669
670 TRANS_SRC = \
671 $(OBJDIR)/add_.c \
672 $(OBJDIR)/ajax_.c \
673 $(OBJDIR)/alerts_.c \
674
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -623,11 +623,11 @@
623623
"$(SRCDIR)\style.pikchrshow.css" \
624624
"$(SRCDIR)\style.uvlist.css" \
625625
"$(SRCDIR)\style.wikiedit.css" \
626626
"$(SRCDIR)\tree.js" \
627627
"$(SRCDIR)\useredit.js" \
628
- "$(SRCDIR)\wiki.wiki"
628
+ "$(SRCDIR)\wiki-rules.txt"
629629
630630
OBJ = "$(OX)\add$O" \
631631
"$(OX)\ajax$O" \
632632
"$(OX)\alerts$O" \
633633
"$(OX)\allrepo$O" \
@@ -1256,11 +1256,11 @@
12561256
echo "$(SRCDIR)\style.pikchrshow.css" >> $@
12571257
echo "$(SRCDIR)\style.uvlist.css" >> $@
12581258
echo "$(SRCDIR)\style.wikiedit.css" >> $@
12591259
echo "$(SRCDIR)\tree.js" >> $@
12601260
echo "$(SRCDIR)\useredit.js" >> $@
1261
- echo "$(SRCDIR)\wiki.wiki" >> $@
1261
+ echo "$(SRCDIR)\wiki-rules.txt" >> $@
12621262
12631263
"$(OX)\add$O" : "$(OX)\add_.c" "$(OX)\add.h"
12641264
$(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\add_.c"
12651265
12661266
"$(OX)\add_.c" : "$(SRCDIR)\add.c"
12671267
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -623,11 +623,11 @@
623 "$(SRCDIR)\style.pikchrshow.css" \
624 "$(SRCDIR)\style.uvlist.css" \
625 "$(SRCDIR)\style.wikiedit.css" \
626 "$(SRCDIR)\tree.js" \
627 "$(SRCDIR)\useredit.js" \
628 "$(SRCDIR)\wiki.wiki"
629
630 OBJ = "$(OX)\add$O" \
631 "$(OX)\ajax$O" \
632 "$(OX)\alerts$O" \
633 "$(OX)\allrepo$O" \
@@ -1256,11 +1256,11 @@
1256 echo "$(SRCDIR)\style.pikchrshow.css" >> $@
1257 echo "$(SRCDIR)\style.uvlist.css" >> $@
1258 echo "$(SRCDIR)\style.wikiedit.css" >> $@
1259 echo "$(SRCDIR)\tree.js" >> $@
1260 echo "$(SRCDIR)\useredit.js" >> $@
1261 echo "$(SRCDIR)\wiki.wiki" >> $@
1262
1263 "$(OX)\add$O" : "$(OX)\add_.c" "$(OX)\add.h"
1264 $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\add_.c"
1265
1266 "$(OX)\add_.c" : "$(SRCDIR)\add.c"
1267
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -623,11 +623,11 @@
623 "$(SRCDIR)\style.pikchrshow.css" \
624 "$(SRCDIR)\style.uvlist.css" \
625 "$(SRCDIR)\style.wikiedit.css" \
626 "$(SRCDIR)\tree.js" \
627 "$(SRCDIR)\useredit.js" \
628 "$(SRCDIR)\wiki-rules.txt"
629
630 OBJ = "$(OX)\add$O" \
631 "$(OX)\ajax$O" \
632 "$(OX)\alerts$O" \
633 "$(OX)\allrepo$O" \
@@ -1256,11 +1256,11 @@
1256 echo "$(SRCDIR)\style.pikchrshow.css" >> $@
1257 echo "$(SRCDIR)\style.uvlist.css" >> $@
1258 echo "$(SRCDIR)\style.wikiedit.css" >> $@
1259 echo "$(SRCDIR)\tree.js" >> $@
1260 echo "$(SRCDIR)\useredit.js" >> $@
1261 echo "$(SRCDIR)\wiki-rules.txt" >> $@
1262
1263 "$(OX)\add$O" : "$(OX)\add_.c" "$(OX)\add.h"
1264 $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\add_.c"
1265
1266 "$(OX)\add_.c" : "$(SRCDIR)\add.c"
1267

Keyboard Shortcuts

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