Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | A single new setting "wiki-classic" switches wiki display between the circa-2007 classic wiki and the new 2025 enhanced wiki. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | comment-markdown-links |
| Files: | files | file ages | folders |
| SHA3-256: |
918a2e2c5e1e047a3da4b27ebbfe5db2 |
| User & Date: | drh 2025-03-14 13:03:57.126 |
Context
|
2025-03-14
| ||
| 13:03 | A single new setting "wiki-classic" switches wiki display between the circa-2007 classic wiki and the new 2025 enhanced wiki. Leaf check-in: 918a2e2c5e user: drh tags: comment-markdown-links | |
| 10:22 | Add documentation for various settings that influence the display of timelines. check-in: 7d67724653 user: drh tags: comment-markdown-links | |
Changes
Changes to src/backlink.c.
| ︙ | ︙ | |||
370 371 372 373 374 375 376 |
assert( ValidBklnk(srctype) );
assert( ValidMTC(mimetype) );
bklnk.srctype = srctype;
bklnk.mtime = mtime;
if( mimetype==MT_NONE || mimetype==MT_WIKI ){
int flags;
if( srctype==BKLNK_COMMENT ){
| | | 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 |
assert( ValidBklnk(srctype) );
assert( ValidMTC(mimetype) );
bklnk.srctype = srctype;
bklnk.mtime = mtime;
if( mimetype==MT_NONE || mimetype==MT_WIKI ){
int flags;
if( srctype==BKLNK_COMMENT ){
flags = WIKI_INLINE | WIKI_MARKDOWN_LINK | WIKI_OVERRIDE;
}else{
flags = 0;
}
wiki_extract_links(zSrc, &bklnk, flags);
}else if( mimetype==MT_MARKDOWN ){
markdown_extract_links(zSrc, &bklnk);
}
|
| ︙ | ︙ |
Changes to src/main.mk.
| ︙ | ︙ | |||
275 276 277 278 279 280 281 | $(SRCDIR)/style.chat.css \ $(SRCDIR)/style.fileedit.css \ $(SRCDIR)/style.pikchrshow.css \ $(SRCDIR)/style.uvlist.css \ $(SRCDIR)/style.wikiedit.css \ $(SRCDIR)/tree.js \ $(SRCDIR)/useredit.js \ | | | 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | $(SRCDIR)/style.chat.css \ $(SRCDIR)/style.fileedit.css \ $(SRCDIR)/style.pikchrshow.css \ $(SRCDIR)/style.uvlist.css \ $(SRCDIR)/style.wikiedit.css \ $(SRCDIR)/tree.js \ $(SRCDIR)/useredit.js \ $(SRCDIR)/wiki-rules.txt TRANS_SRC = \ $(OBJDIR)/add_.c \ $(OBJDIR)/ajax_.c \ $(OBJDIR)/alerts_.c \ $(OBJDIR)/allrepo_.c \ $(OBJDIR)/attach_.c \ |
| ︙ | ︙ |
Changes to src/printf.c.
| ︙ | ︙ | |||
265 266 267 268 269 270 271 | ** In other words, newlines are coverted into <br> for HTML display. ** The default behavior, when this setting is off, is that newlines are ** treated like any other whitespace character. */ /* ** Return an appropriate set of flags for wiki_convert() for displaying | | | | > | < < | < < < < | 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 |
** In other words, newlines are coverted into <br> for HTML display.
** The default behavior, when this setting is off, is that newlines are
** treated like any other whitespace character.
*/
/*
** Return an appropriate set of flags for wiki_convert() for displaying
** check-in comments on a timeline (%W) or for general display (%!W).
** The flags are determined by settings.
**
** The altForm2 argument is true for "%!W" (indicating that the rendered
** wiki text is for general display) and false for "%W" (indicating that
** the text is being displayed in a timeline.
*/
static int wiki_convert_flags(int altForm2){
static int wikiFlags = 0;
if( wikiFlags==0 ){
if( db_get_boolean("timeline-block-markup", 0) ){
wikiFlags = WIKI_INLINE | WIKI_NOBADLINKS;
}else{
wikiFlags = WIKI_INLINE | WIKI_NOBLOCK | WIKI_NOBADLINKS;
}
if( db_get_boolean("timeline-plaintext", 0) ){
wikiFlags |= WIKI_LINKSONLY | WIKI_OVERRIDE;
wikiFlags &= ~WIKI_MARKDOWN_INLINE;
}
if( db_get_boolean("timeline-hard-newlines", 0) ){
wikiFlags |= WIKI_NEWLINE;
}
}
if( altForm2 ){
/* block markup (ex: <p>, <table>) allowed */
|
| ︙ | ︙ |
Changes to src/setup.c.
| ︙ | ︙ | |||
986 987 988 989 990 991 992 |
static const char *const azTimeFormats[] = {
"0", "HH:MM",
"1", "HH:MM:SS",
"2", "YYYY-MM-DD HH:MM",
"3", "YYMMDD HH:MM",
"4", "(off)"
};
| < < < < < < < < < < < < < < < < < < < < | 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 |
static const char *const azTimeFormats[] = {
"0", "HH:MM",
"1", "HH:MM:SS",
"2", "YYYY-MM-DD HH:MM",
"3", "YYMMDD HH:MM",
"4", "(off)"
};
login_check_credentials();
if( !g.perm.Admin ){
login_needed(0);
return;
}
style_set_current_feature("setup");
style_header("Timeline Display Preferences");
db_begin_transaction();
@ <form action="%R/setup_timeline" method="post"><div>
login_insert_csrf_secret();
@ <p><input type="submit" name="submit" value="Apply Changes"></p>
@ <hr>
onoff_attribute("Allow block-markup in timeline",
"timeline-block-markup", "tbm", 0, 0);
@ <p>In timeline displays, check-in comments can be displayed with or
@ without block markup such as paragraphs, tables, etc.
@ (Property: "timeline-block-markup")</p>
@ <hr>
onoff_attribute("Plaintext comments on timelines",
"timeline-plaintext", "tpt", 0, 0);
@ <p>In timeline displays, check-in comments are displayed literally,
@ without any wiki or HTML interpretation. This setting takes priority
@ over the timeline-block-markup and timeline-markdown settings
@ above.
|
| ︙ | ︙ | |||
1450 1451 1452 1453 1454 1455 1456 |
style_set_current_feature("setup");
style_header("Wiki Configuration");
db_begin_transaction();
@ <form action="%R/setup_wiki" method="post"><div>
login_insert_csrf_secret();
@ <input type="submit" name="submit" value="Apply Changes"></p>
@ <hr>
| | | > > > > > > > > > > > > > > > > > > > > > > | 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 |
style_set_current_feature("setup");
style_header("Wiki Configuration");
db_begin_transaction();
@ <form action="%R/setup_wiki" method="post"><div>
login_insert_csrf_secret();
@ <input type="submit" name="submit" value="Apply Changes"></p>
@ <hr>
onoff_attribute("Associate Wiki Pages With Branches, Tags, Tickets,"
" or Checkins", "wiki-about", "wiki-about", 1, 0);
@ <p>
@ Associate wiki pages with branches, tags, tickets, or checkins, based on
@ the wiki page name. Wiki pages that begin with "branch/", "checkin/",
@ "tag/" or "ticket" and which continue with the name of an existing branch,
@ check-in, tag or ticket are treated specially when this feature is enabled.
@ <ul>
@ <li> <b>branch/</b><i>branch-name</i>
@ <li> <b>checkin/</b><i>full-check-in-hash</i>
@ <li> <b>tag/</b><i>tag-name</i>
@ <li> <b>ticket/</b><i>full-ticket-hash</i>
@ </ul>
@ (Property: "wiki-about")</p>
@ <hr>
onoff_attribute("Disable the 2025 enhancements to wiki formatting rules",
"wiki-classic", "wiki-classic", 0, 0);
@ <p>When enabled, only the original circa-2007 wiki formatting rules are
@ recognized. The new formatting rules added in 2025 are ignored. Enable
@ this setting if you are hosting an older repository that has preexisting
@ wiki content that is adversely affected by the new rules.
@ The enhanced wiki formatting rules added in 2025 are:
@ <ul>
@ <li> Markdown-style hyperlinks: \
@ <tt>[display](URL)</tt>
@ <li> Angle-bracket hyperlinks:  <tt><URL></tt>
@ <li> Font changes: 
@ <tt>*italic*</tt>  \
@ <tt>**bold**</tt>  \
@ <tt>`teletype`</tt>
@ <li> Backslash escapes: \
@ <tt>\></tt>   <tt>\[</tt>   <tt>\*</tt>  
@ <tt>\_</tt>   <tt>\'</tt>   <tt>\\</tt>  
@ <i>and so forth...</i>
@ </ul>
@ (Property: "wiki-classic")
@ <hr>
entry_attribute("Allow Unsafe HTML In Markdown", 6,
"safe-html", "safe-html", "", 0);
@ <p>Allow "unsafe" HTML (ex: <script>, <form>, etc) to be
@ generated by <a href="%R/md_rules">Markdown-formatted</a> documents.
@ This setting is a string where each character indicates a "type" of
@ document in which to allow unsafe HTML:
|
| ︙ | ︙ |
Name change from src/wiki.wiki to src/wiki-rules.txt.
1 2 | <h2>Wiki Formatting Rule Summary</h2> | > | | | | | | | | | > > > | > > > > > | | < < > | | | | | | | | | | < < | | > > > > > > > | > > > > > > > > > > > > > > > | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
<h2>Wiki Formatting Rule Summary</h2>
<ol>
<li> Blank lines are paragraph breaks
<li> Bullets are "*" surrounded by two spaces at the beginning of a line
<li> Enumeration items are "#" or a digit and a "." surrounded by two
spaces at the beginning of a line
<li> Indented paragraphs begin with a tab or two spaces
<li> Hyperlinks in square brackets:
"<b>[</b><i>target</i><b>]</b>"
or "<b>[</b><i>target</i><b>|</b><i>label</i><b>]</b>"
or "<b><</b><i>URL</i><b>></b>"
+<li> Hyperlinks in angle brackets: "<b><</b><i>URL</i><b>></b>"
+<li> Markdown-style hyperlinks:
+ "<b>[</b><i>label</i><b>](</b><i>target</i><b>)</b>"
<li> Most ordinary HTML works
+<li> Fonts: "<b>*</b><i>italic</i><b>*</b>",
+ "<b>**</b><i>bold</i><b>**</b>",
+ "<b>`</b><i>teletype</i><b>`</b>".
+<li> Backslash escapes: <b>\< \[ \* \_ 
+ \> \\</b> <i>and so forth....</i>
<li> <verbatim> and <nowiki>
</ol>
<h2>Formatting Rule Details</h2>
<ol>
<li> <p><b>Paragraphs.</b>
Any sequence of one or more blank lines forms a paragraph break.
Centered or right-justified paragraphs are not supported by wiki markup,
but you can do these things if you need them using HTML.
<li> <p><b>Bullet Lists.</b>
A bullet list item is a line that begins with a single "*" character
surrounded on both sides by two or more spaces or by a tab.
Only a single level of bullet list is supported by wiki.
For nested lists, use HTML.
<li> <p><b>Enumeration Lists.</b>
An enumeration list item is a line that begins with a single "#"
character surrounded on both sides by two or more spaces or by a tab.
Or it can be a number and a "." (ex: "5.") surrounded on both sides
by two spaces or a tab.
Only a single level of enumeration list is supported by wiki.
For nested lists or for enumerations that count using letters or
roman numerals, use HTML.
<li> <p><b>Indented Paragraphs.</b>
Any paragraph that begins with two or more spaces or a tab and which
is not a bullet or enumeration list item is rendered indented.
Only a single level of indentation is supported by wiki.
Use HTML for deeper indentation.
<li> <p><b>Hyperlinks.</b>
Text within square brackets ("[...]") becomes a
hyperlink. The target can be a wiki page name, the artifact ID of
a check-in or ticket, the name of an image, a URL, or an
[#intermap|interwiki link] of the form
"<i>Tag</i><b>:</b><i>PageName</i>".
By default, the target is displayed as the text of the hyperlink.
But you can specify alternative text after the target name
separated by a "|" character.
You can also link to internal anchor names using
[#anchor-name], providing you have added the necessary
"<a name='anchor-name'></a>" tag to your wiki page.
+<li> <p><b>Auto-links</b>
+ A URL that begins with "http://" or "https://" and that is
+ enclosed in <...> functions as a hyperlink.
+
+
+<li> <p><b>Markdown-style hyperlinks</b>
+ Links of the form
+ "<b>[</b><i>display-text</i><b>](</b><i>target</i><b>)</b>"
+ show "<i>display-text</i>" on screen and make it a hyperlin
+ to "<i>target</i>".
<li> <p><b>HTML.</b>
The following standard HTML elements may be used:
<a> <address> <article> <aside> <b>
<big> <blockquote> <br> <center> <cite>
<code> <col> <colgroup> <dd>
<del> <dfn>
<div> <dl> <dt> <em> <font> <footer>
<ins>
<h1> <h2> <h3> <h4> <h5> <h6>
<header> <hr> <i> <img> <kbd> <li>
<nav> <nobr> <nowiki> <ol> <p> <pre>
<s> <samp> <section> <small> <span>
<strike> <strong> <sub> <sup> <table>
<tbody> <td> <tfoot> <th> <thead>
<title> <tr> <tt> <u> <ul> <var>
<verbatim>. There are two non-standard elements available:
<verbatim> and <nowiki>. No other elements are allowed.
All attributes are checked and only a few benign attributes are
allowed on each element. In particular, any attributes that specify
javascript or CSS are elided.
+<li> <p><b>Font Markup.</b>
+ Text enclosed within "<tt>*...*</tt>" or "<tt>_..._</tt>" is
+ emphasized (italic font). Text within "<tt>**...**</tt>" or
+ "<tt>__...__</tt>" gets strong emphasis (bold font).
+ Text within "<tt>`...`</tt>" is rendered literally using a
+ constant-width font. Special characters (ex: "<" or "[") within
+ "<tt>`...`</tt>" lose their special meaning and are rendered
+ literally.
+
+<li> <p><b>Backslash escapes.</b>
+ A backslash followed by any other character is rendered as just
+ the other character. The character that follows the backslash
+ loses any special meaning it might have had otherwise. This is
+ useful for escaping markup for literal display.
<li> <p><b>Special Markup.</b>
The <nowiki> tag disables all wiki formatting rules through
the matching </nowiki> element. The <verbatim> tag works
like <pre> with the addition that it also disables all wiki
and HTML markup through the matching </verbatim>.
Text within
<tt><verbatim type="pikchr">...</verbatim></tt>
is formatted using <a href="https://pikchr.org/home">Pikchr</a>.
</ol>
<a name="intermap"></a>
<h2>Interwiki Tag [/intermap|Map]</h2>
|
Changes to src/wiki.c.
| ︙ | ︙ | |||
262 263 264 265 266 267 268 |
/*
** WEBPAGE: wiki_rules
**
** Show a summary of the wiki formatting rules.
*/
void wiki_rules_page(void){
| | > | > > > > > > > > | | | > > > > | > > > > > > | > > > > > > > > | > | | < | | 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
/*
** WEBPAGE: wiki_rules
**
** Show a summary of the wiki formatting rules.
*/
void wiki_rules_page(void){
Blob x, y, line;
int bClDflt = db_get_boolean("wiki-classic",0);
int bClassic;
if( P("classic")!=0 ){
bClassic = 1;
}else if( P("enhanced")!=0 ){
bClassic = 0;
}else{
bClassic = bClDflt;
}
style_set_current_feature("wiki");
style_header("Wiki Formatting Rules");
style_submenu_element("Markdown","%R/md_rules");
if( bClassic ){
style_submenu_element("Enhanced-Wiki","%R/wiki_rules?enhanced");
}else{
style_submenu_element("Classic-Wiki","%R/wiki_rules?classic");
}
if( bClassic && !bClDflt ){
@ <p>NOTE: This repository is set to render wiki text using the
@ <a href="%R/wiki_rules">Enhanced Wiki Rules</a>. The following
@ describes the Classic Wiki Rules where are a subset of the
@ enhanced rules.
}else if( !bClassic && bClDflt ){
@ <p>NOTE: This repository is set to render wiki text using the
@ <a href="%R/wiki_rules">Classic Wiki Rules</a>. The following
@ describes the Enhanced Wiki Rules where are a subset of the
@ classic rules.
}
blob_init(&x, builtin_text("wiki-rules.txt"), -1);
blob_init(&y, 0, 0);
while( blob_line(&x, &line) ){
if( blob_buffer(&line)[0]!='+' ){
blob_append(&y, blob_buffer(&line), blob_size(&line));
}else if( !bClassic ){
blob_append(&y, blob_buffer(&line)+1, blob_size(&line)-1);
}
}
blob_reset(&x);
blob_reset(&line);
interwiki_append_map_table(&y);
cgi_append_content(blob_buffer(&y), blob_size(&y));
blob_reset(&y);
style_finish_page();
}
/*
** WEBPAGE: markup_help
**
** Show links to the md_rules and wiki_rules pages.
|
| ︙ | ︙ |
Changes to src/wikiformat.c.
| ︙ | ︙ | |||
498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 |
struct sStack {
short iCode; /* Markup code */
short allowWiki; /* ALLOW_WIKI if wiki allowed before tag */
const char *zId; /* ID attribute or NULL */
} *aStack;
};
/*
** Return TRUE if HTML should be used as the sole markup language for wiki.
**
** On first invocation, this routine consults the "wiki-use-html" setting.
** It caches the result for subsequent invocations, under the assumption
** that the setting will not change.
*/
static int wikiUsesHtml(void){
static int r = -1;
if( r<0 ) r = db_get_boolean("wiki-use-html", 0);
return r;
}
/*
** z points to a "<" character. Check to see if this is the start of
** a valid markup. If it is, return the total number of characters in
** the markup including the initial "<" and the terminating ">". If
** it is not well-formed markup, return 0.
*/
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 |
struct sStack {
short iCode; /* Markup code */
short allowWiki; /* ALLOW_WIKI if wiki allowed before tag */
const char *zId; /* ID attribute or NULL */
} *aStack;
};
/*
** SETTING: wiki-use-html boolean default=off
**
** If enabled, recognize only HTML in Fossil Wiki text. Other wiki markup
** is ignored. In other words, this setting make HTML the wiki markup
** language.
**
** CAUTION: When enabled, this setting allows *all* HTML text through,
** unsanitized. Only use this setting in closed environments where all
** inputs are from trusted users, as the ability to inject arbitrary
** HTML can be misused by rapscallions.
*/
/*
** Return TRUE if HTML should be used as the sole markup language for wiki.
**
** On first invocation, this routine consults the "wiki-use-html" setting.
** It caches the result for subsequent invocations, under the assumption
** that the setting will not change.
*/
static int wikiUsesHtml(void){
static int r = -1;
if( r<0 ) r = db_get_boolean("wiki-use-html", 0);
return r;
}
/*
** SETTING: wiki-classic boolean default=off
**
** When enabled, this setting causes Fossil Wiki text to be rendered
** in the original circa-2007 style which omits the enhancements added
** in 2025. Enable this setting if you have an older repository with
** a lot of wiki-formatted text that does not render well using the
** new enhancements.
**
** The specific wiki formatting enhancements that are disabled when
** then setting is turned on are:
**
** * Markdown hyperlinks: [display-text](URL)
** * Bracket hyperlinks: <URL>
** * Font changes: *italic* **bold** `teletype`
** * Backslash escapes: \\< \\[ \\* \\' \\_ \\\\ and so forth
*/
/*
** Return TRUE limit wiki formatting to the classic circa-2007 style
** and omit the 2025 enhancements.
*/
static int wikiClassic(void){
static int r = -1;
if( r<0 ) r = db_get_boolean("wiki-classic", 0);
return r;
}
/*
** z points to a "<" character. Check to see if this is the start of
** a valid markup. If it is, return the total number of characters in
** the markup including the initial "<" and the terminating ">". If
** it is not well-formed markup, return 0.
*/
|
| ︙ | ︙ | |||
2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 |
*/
void wiki_convert(Blob *pIn, Blob *pOut, int flags){
Renderer renderer;
memset(&renderer, 0, sizeof(renderer));
renderer.renderFlags = flags;
renderer.state = ALLOW_WIKI|AT_NEWLINE|AT_PARAGRAPH|flags;
if( flags & WIKI_INLINE ){
renderer.wantAutoParagraph = 0;
}else{
renderer.wantAutoParagraph = 1;
}
if( wikiUsesHtml() ){
renderer.state |= WIKI_HTMLONLY;
| > > > > > > > | 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 |
*/
void wiki_convert(Blob *pIn, Blob *pOut, int flags){
Renderer renderer;
memset(&renderer, 0, sizeof(renderer));
renderer.renderFlags = flags;
renderer.state = ALLOW_WIKI|AT_NEWLINE|AT_PARAGRAPH|flags;
if( (flags & WIKI_OVERRIDE)==0 ){
if( wikiClassic() ){
renderer.state &= ~(WIKI_MARKDOWN_INLINE);
}else{
renderer.state |= WIKI_MARKDOWN_INLINE;
}
}
if( flags & WIKI_INLINE ){
renderer.wantAutoParagraph = 0;
}else{
renderer.wantAutoParagraph = 1;
}
if( wikiUsesHtml() ){
renderer.state |= WIKI_HTMLONLY;
|
| ︙ | ︙ | |||
2131 2132 2133 2134 2135 2136 2137 | ** ** Usage: %fossil test-wiki-render FILE [OPTIONS] ** ** Translate the input FILE from Fossil-wiki into HTML and write ** the resulting HTML on standard output. ** ** Options: | | > > > > > > > > > | 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 |
**
** Usage: %fossil test-wiki-render FILE [OPTIONS]
**
** Translate the input FILE from Fossil-wiki into HTML and write
** the resulting HTML on standard output.
**
** Options:
** --buttons Set the WIKI_BUTTONS flag
** --classic Use only classic wiki rules
** --dark-pikchr Render pikchrs in dark mode
** --enhanced Use 2025 enhanced wiki rules
** --htmlonly Set the WIKI_HTMLONLY flag
** --inline Set the WIKI_INLINE flag
** --linksonly Set the WIKI_LINKSONLY flag
** --markdown Allow all in-line markdown syntax
** --markdown-link Allow markdown hyperlink syntax
** --markdown-style Allow markdown font and style markup
** --nobadlinks Set the WIKI_NOBADLINKS flag
** --noblock Set the WIKI_NOBLOCK flag
** --text Run the output through html_to_plaintext().
** --tokenize Output a tokenization of the input file
*/
void test_wiki_render(void){
Blob in, out;
int flags = ALLOW_LINKS;
int bText, bTokenize;
if( find_option("buttons",0,0)!=0 ) flags |= WIKI_BUTTONS;
if( find_option("classic",0,0)!=0 ){
flags |= WIKI_OVERRIDE;
flags &= ~(WIKI_MARKDOWN_INLINE);
}
if( find_option("enhanced",0,0)!=0 ){
flags |= WIKI_OVERRIDE|WIKI_MARKDOWN_INLINE;
}
if( find_option("htmlonly",0,0)!=0 ) flags |= WIKI_HTMLONLY;
if( find_option("linksonly",0,0)!=0 ) flags |= WIKI_LINKSONLY;
if( find_option("nobadlinks",0,0)!=0 ) flags |= WIKI_NOBADLINKS;
if( find_option("inline",0,0)!=0 ) flags |= WIKI_INLINE;
if( find_option("noblock",0,0)!=0 ) flags |= WIKI_NOBLOCK;
if( find_option("markdown",0,0)!=0 ) flags |= WIKI_MARKDOWN_INLINE;
if( find_option("markdown-style",0,0)!=0 ) flags |= WIKI_MARKDOWN_FONT;
|
| ︙ | ︙ | |||
2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 |
}
/*
** Parse text looking for wiki hyperlinks in one of the formats:
**
** [target]
** [target|...]
**
** Where "target" can be either an artifact ID prefix or a wiki page
** name. For each such hyperlink found, add an entry to the
** backlink table.
*/
void wiki_extract_links(
char *z, /* The wiki text from which to extract links */
Backlink *pBklnk, /* Backlink extraction context */
int flags /* wiki parsing flags */
){
Renderer renderer;
int tokenType;
ParsedMarkup markup;
int n;
| > < < | < < | < < < < < < < < < | < | 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 |
}
/*
** Parse text looking for wiki hyperlinks in one of the formats:
**
** [target]
** [target|...]
** [display](target)
**
** Where "target" can be either an artifact ID prefix or a wiki page
** name. For each such hyperlink found, add an entry to the
** backlink table.
*/
void wiki_extract_links(
char *z, /* The wiki text from which to extract links */
Backlink *pBklnk, /* Backlink extraction context */
int flags /* wiki parsing flags */
){
Renderer renderer;
int tokenType;
ParsedMarkup markup;
int n;
memset(&renderer, 0, sizeof(renderer));
renderer.state = ALLOW_WIKI;
while( z[0] ){
n = nextWikiToken(z, &renderer, &tokenType);
switch( tokenType ){
case TOKEN_LINK: {
char *zTarget, *zEnd;
int i;
if( z[n]=='('
&& (flags & WIKI_MARKDOWN_LINK)!=0
|
| ︙ | ︙ | |||
2400 2401 2402 2403 2404 2405 2406 |
}else{
renderer.state &= ~ALLOW_WIKI;
}
}else
/* Ignore block markup for in-line rendering.
*/
| | | 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 |
}else{
renderer.state &= ~ALLOW_WIKI;
}
}else
/* Ignore block markup for in-line rendering.
*/
if( (markup.iType & MUTYPE_INLINE)==0 ){
/* Do nothing */
}else
/* Generate end-tags */
if( markup.endTag ){
popStackToTag(&renderer, markup.iCode);
}else
|
| ︙ | ︙ |
Changes to tools/makemake.tcl.
| ︙ | ︙ | |||
210 211 212 213 214 215 216 |
# Additional resource files that get built into the executable.
# These paths are all resolved from the src/ directory, so must
# be relative to that.
set extra_files {
diff.tcl
merge.tcl
markdown.md
| | | 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
# Additional resource files that get built into the executable.
# These paths are all resolved from the src/ directory, so must
# be relative to that.
set extra_files {
diff.tcl
merge.tcl
markdown.md
wiki-rules.txt
*.js
default.css
style.*.css
../skins/*/*.txt
sounds/*.wav
alerts/*.wav
../extsrc/pikchr.wasm
|
| ︙ | ︙ |
Changes to win/Makefile.mingw.
| ︙ | ︙ | |||
661 662 663 664 665 666 667 | $(SRCDIR)/style.chat.css \ $(SRCDIR)/style.fileedit.css \ $(SRCDIR)/style.pikchrshow.css \ $(SRCDIR)/style.uvlist.css \ $(SRCDIR)/style.wikiedit.css \ $(SRCDIR)/tree.js \ $(SRCDIR)/useredit.js \ | | | 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 | $(SRCDIR)/style.chat.css \ $(SRCDIR)/style.fileedit.css \ $(SRCDIR)/style.pikchrshow.css \ $(SRCDIR)/style.uvlist.css \ $(SRCDIR)/style.wikiedit.css \ $(SRCDIR)/tree.js \ $(SRCDIR)/useredit.js \ $(SRCDIR)/wiki-rules.txt TRANS_SRC = \ $(OBJDIR)/add_.c \ $(OBJDIR)/ajax_.c \ $(OBJDIR)/alerts_.c \ $(OBJDIR)/allrepo_.c \ $(OBJDIR)/attach_.c \ |
| ︙ | ︙ |
Changes to win/Makefile.msc.
| ︙ | ︙ | |||
621 622 623 624 625 626 627 |
"$(SRCDIR)\style.chat.css" \
"$(SRCDIR)\style.fileedit.css" \
"$(SRCDIR)\style.pikchrshow.css" \
"$(SRCDIR)\style.uvlist.css" \
"$(SRCDIR)\style.wikiedit.css" \
"$(SRCDIR)\tree.js" \
"$(SRCDIR)\useredit.js" \
| | | 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 |
"$(SRCDIR)\style.chat.css" \
"$(SRCDIR)\style.fileedit.css" \
"$(SRCDIR)\style.pikchrshow.css" \
"$(SRCDIR)\style.uvlist.css" \
"$(SRCDIR)\style.wikiedit.css" \
"$(SRCDIR)\tree.js" \
"$(SRCDIR)\useredit.js" \
"$(SRCDIR)\wiki-rules.txt"
OBJ = "$(OX)\add$O" \
"$(OX)\ajax$O" \
"$(OX)\alerts$O" \
"$(OX)\allrepo$O" \
"$(OX)\attach$O" \
"$(OX)\backlink$O" \
|
| ︙ | ︙ | |||
1254 1255 1256 1257 1258 1259 1260 | echo "$(SRCDIR)\style.chat.css" >> $@ echo "$(SRCDIR)\style.fileedit.css" >> $@ echo "$(SRCDIR)\style.pikchrshow.css" >> $@ echo "$(SRCDIR)\style.uvlist.css" >> $@ echo "$(SRCDIR)\style.wikiedit.css" >> $@ echo "$(SRCDIR)\tree.js" >> $@ echo "$(SRCDIR)\useredit.js" >> $@ | | | 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 | echo "$(SRCDIR)\style.chat.css" >> $@ echo "$(SRCDIR)\style.fileedit.css" >> $@ echo "$(SRCDIR)\style.pikchrshow.css" >> $@ echo "$(SRCDIR)\style.uvlist.css" >> $@ echo "$(SRCDIR)\style.wikiedit.css" >> $@ echo "$(SRCDIR)\tree.js" >> $@ echo "$(SRCDIR)\useredit.js" >> $@ echo "$(SRCDIR)\wiki-rules.txt" >> $@ "$(OX)\add$O" : "$(OX)\add_.c" "$(OX)\add.h" $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\add_.c" "$(OX)\add_.c" : "$(SRCDIR)\add.c" "$(OBJDIR)\translate$E" $** > $@ |
| ︙ | ︙ |