Fossil

Check-in [8f55b909c4]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment: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.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | comment-markdown-links
Files: files | file ages | folders
SHA3-256: 8f55b909c4d23d066ba49d67d5b1d8c38e6e27d4ecde14036f8e53747ebb48fa
User & Date: drh 2025-03-04 12:21:20.835
Context
2025-03-04
14:01
Implement backslash-escapes in WIKI_MARKDOWN_SPAN mode. Add the --tokenize option to the test-wiki-render command. check-in: 6f9e299244 user: drh tags: comment-markdown-links
12:21
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. check-in: 8f55b909c4 user: drh tags: comment-markdown-links
11:48
Change the rendering option to WIKI_MARKDOWN_SPAN with the idea of eventually supporting all kinds of span-markdown, just not block-markdown. Add support for auto-links. check-in: f80b892178 user: drh tags: comment-markdown-links
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/configure.c.
104
105
106
107
108
109
110

111
112
113
114
115
116
117
  { "icon-image",             CONFIGSET_SKIN },
  { "timeline-block-markup",  CONFIGSET_SKIN },
  { "timeline-date-format",   CONFIGSET_SKIN },
  { "timeline-default-style", CONFIGSET_SKIN },
  { "timeline-dwelltime",     CONFIGSET_SKIN },
  { "timeline-closetime",     CONFIGSET_SKIN },
  { "timeline-hard-newlines", CONFIGSET_SKIN },

  { "timeline-max-comment",   CONFIGSET_SKIN },
  { "timeline-plaintext",     CONFIGSET_SKIN },
  { "timeline-truncate-at-blank", CONFIGSET_SKIN },
  { "timeline-tslink-info",   CONFIGSET_SKIN },
  { "timeline-utc",           CONFIGSET_SKIN },
  { "adunit",                 CONFIGSET_SKIN },
  { "adunit-omit-if-admin",   CONFIGSET_SKIN },







>







104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
  { "icon-image",             CONFIGSET_SKIN },
  { "timeline-block-markup",  CONFIGSET_SKIN },
  { "timeline-date-format",   CONFIGSET_SKIN },
  { "timeline-default-style", CONFIGSET_SKIN },
  { "timeline-dwelltime",     CONFIGSET_SKIN },
  { "timeline-closetime",     CONFIGSET_SKIN },
  { "timeline-hard-newlines", CONFIGSET_SKIN },
  { "timeline-markdown-span", CONFIGSET_SKIN },
  { "timeline-max-comment",   CONFIGSET_SKIN },
  { "timeline-plaintext",     CONFIGSET_SKIN },
  { "timeline-truncate-at-blank", CONFIGSET_SKIN },
  { "timeline-tslink-info",   CONFIGSET_SKIN },
  { "timeline-utc",           CONFIGSET_SKIN },
  { "adunit",                 CONFIGSET_SKIN },
  { "adunit-omit-if-admin",   CONFIGSET_SKIN },
Changes to src/printf.c.
255
256
257
258
259
260
261



262
263
264

265
266
267
268
269
270
271
272
273
274
275
276
277
278
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;

    }
    if( db_get_boolean("timeline-hard-newlines", 0) ){
      wikiFlags |= WIKI_NEWLINE;
    }
    if( db_get_boolean("timeline-markdown-span", 1) ){
      wikiFlags |= WIKI_MARKDOWN_SPAN;
    }
  }
  if( altForm2 ){
    /* block markup (ex: <p>, <table>) allowed */
    return  wikiFlags & ~WIKI_NOBLOCK;
  }else{
    /* Do not allow any block format.  Everything in a <span> */
    return wikiFlags;







>
>
>



>




<
<
<







255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272



273
274
275
276
277
278
279
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-markdown-span", 0) ){
      wikiFlags |= WIKI_MARKDOWN_SPAN;
    }
    if( db_get_boolean("timeline-plaintext", 0) ){
      wikiFlags |= WIKI_LINKSONLY;
      wikiFlags &= ~WIKI_MARKDOWN_SPAN;
    }
    if( db_get_boolean("timeline-hard-newlines", 0) ){
      wikiFlags |= WIKI_NEWLINE;
    }



  }
  if( altForm2 ){
    /* block markup (ex: <p>, <table>) allowed */
    return  wikiFlags & ~WIKI_NOBLOCK;
  }else{
    /* Do not allow any block format.  Everything in a <span> */
    return wikiFlags;
Changes to src/setup.c.
1003
1004
1005
1006
1007
1008
1009










1010
1011
1012
1013
1014
1015

1016
1017
1018
1019
1020
1021
1022
  @ <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.  Use CSS to change
  @ display formatting features such as fonts and line-wrapping behavior.

  @ (Property: "timeline-plaintext")</p>

  @ <hr>
  onoff_attribute("Truncate comment at first blank line (Git-style)",
                  "timeline-truncate-at-blank", "ttb", 0, 0);
  @ <p>In timeline displays, check-in comments are displayed only through
  @ the first blank line.  This is the traditional way to display comments







>
>
>
>
>
>
>
>
>
>




|
|
>







1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
  @ <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("Allow markdown style span-markup in timeline",
                  "timeline-markdown-span", "tms", 0, 0);
  @ <p>In timeline displays, intrepret <a href="%R/md_rules">markdown</a>
  @ span markup (hyperlinks and emphasis marks such as "<tt>**bold**</tt>"
  @ but not headers, paragraphs, tables, footnotes, etc.) in check-in
  @ comments.  Without this option, only <a href="%R/wiki_rules">Fossil Wiki</a>
  @ formatting is allowed.
  @ (Property: "timeline-markdown-span")</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-span settings
  @ above.
  @ (Property: "timeline-plaintext")</p>

  @ <hr>
  onoff_attribute("Truncate comment at first blank line (Git-style)",
                  "timeline-truncate-at-blank", "ttb", 0, 0);
  @ <p>In timeline displays, check-in comments are displayed only through
  @ the first blank line.  This is the traditional way to display comments
Changes to src/wiki.wiki.
1
2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17
<h2>Wiki Formatting Rule Summary</h2>

  #  Blank lines are paragraph breaks
  #  Bullets are "*" surrounded by two spaces at the beginning of a line
  #  Enumeration items are "#" or a digit and a "." surrounded by two
     spaces at the beginning of a line
  #  Indented paragraphs begin with a tab or two spaces
  #  Hyperlinks are contained within square brackets:
     <nowiki>"<b>[</b><i>target</i><b>]</b>"
     or "<b>[</b><i>target</i><b>|</b><i>label</i><b>]</b>"</nowiki>

  #  Most ordinary HTML works
  #  &lt;verbatim&gt; and &lt;nowiki&gt;

We call the first five rules above the "wiki" formatting rules.
The last two rules are the HTML formatting rules.

<h2>Formatting Rule Details</h2>










>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<h2>Wiki Formatting Rule Summary</h2>

  #  Blank lines are paragraph breaks
  #  Bullets are "*" surrounded by two spaces at the beginning of a line
  #  Enumeration items are "#" or a digit and a "." surrounded by two
     spaces at the beginning of a line
  #  Indented paragraphs begin with a tab or two spaces
  #  Hyperlinks are contained within square brackets:
     <nowiki>"<b>[</b><i>target</i><b>]</b>"
     or "<b>[</b><i>target</i><b>|</b><i>label</i><b>]</b>"</nowiki>
     or "<b>&lt;</b><i>URL</i><b>&gt;</b>"
  #  Most ordinary HTML works
  #  &lt;verbatim&gt; and &lt;nowiki&gt;

We call the first five rules above the "wiki" formatting rules.
The last two rules are the HTML formatting rules.

<h2>Formatting Rule Details</h2>
50
51
52
53
54
55
56






57
58
59
60
61
62
63
      "<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 
      <nowiki>[#anchor-name],</nowiki> providing you have added the necessary 
      "&lt;a name='anchor-name'&gt;&lt;/a&gt;" tag to your wiki page.







  6.  <b>HTML.</b>
      The following standard HTML elements may be used:
      &lt;a&gt; &lt;address&gt; &lt;article&gt; &lt;aside&gt; &lt;b&gt;
      &lt;big&gt; &lt;blockquote&gt; &lt;br&gt; &lt;center&gt; &lt;cite&gt;
      &lt;code&gt; &lt;col&gt; &lt;colgroup&gt; &lt;dd&gt; 
      &lt;del&gt; &lt;dfn&gt;







>
>
>
>
>
>







51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
      "<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 
      <nowiki>[#anchor-name],</nowiki> providing you have added the necessary 
      "&lt;a name='anchor-name'&gt;&lt;/a&gt;" tag to your wiki page.
      <p>
      Support for "auto-link" hyperlinks consisting of a URL that begins
      with "http://" or "https://" and that is enclosed in &lt;...&gt; was
      added on 2025-03-04.  Formerly, such text would be displayed literally.
      The change is that now the URL is rendered enclosed within
      &lt;a&gt;...&lt;/a&gt; so that it actually functions as a hyperlink.

  6.  <b>HTML.</b>
      The following standard HTML elements may be used:
      &lt;a&gt; &lt;address&gt; &lt;article&gt; &lt;aside&gt; &lt;b&gt;
      &lt;big&gt; &lt;blockquote&gt; &lt;br&gt; &lt;center&gt; &lt;cite&gt;
      &lt;code&gt; &lt;col&gt; &lt;colgroup&gt; &lt;dd&gt; 
      &lt;del&gt; &lt;dfn&gt;
Changes to src/wikiformat.c.
1658
1659
1660
1661
1662
1663
1664
1665






1666
1667
1668
1669

1670
1671
1672


1673
1674
1675
1676
1677
1678
1679
          htmlize_to_blob(p->pOut, z, n);
        }else{
          blob_append(p->pOut, z, n);
        }
        break;
      }
      case TOKEN_AUTOLINK: {
        /* URL enclosed in <...> */






        if( (p->state & WIKI_MARKDOWN_SPAN)==0 ){
          blob_append(p->pOut, "&lt;", 4);
          n = 1;
        }else{

          z[n-1] = 0;
          blob_appendf(p->pOut, "<a href=\"%h\">%h</a>", z+1, z+1);
          z[n-1] = '>';


        }
        break;
      }
      case TOKEN_MARKUP: {
        const char *zId;
        int iDiv;
        int mAttr = parseMarkup(&markup, z);







|
>
>
>
>
>
>


<
<
>
|
|
|
>
>







1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673


1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
          htmlize_to_blob(p->pOut, z, n);
        }else{
          blob_append(p->pOut, z, n);
        }
        break;
      }
      case TOKEN_AUTOLINK: {
        /* URL enclosed in <...>
        **
        ** Originally, Fossil-Wiki would just display this as literal
        ** text, but as of 2025-03-04, it actually inserts an <a>..</a>
        ** for the hyperlink.  The <...> delimiters are retained, however.
        ** Except in markdown-span mode, the <...> delimiters are omitted.
        */
        if( (p->state & WIKI_MARKDOWN_SPAN)==0 ){
          blob_append(p->pOut, "&lt;", 4);


        }
        z[n-1] = 0;
        blob_appendf(p->pOut, "<a href=\"%h\">%h</a>", z+1, z+1);
        z[n-1] = '>';
        if( (p->state & WIKI_MARKDOWN_SPAN)==0 ){
          blob_append(p->pOut, "&gt;", 4);
        }
        break;
      }
      case TOKEN_MARKUP: {
        const char *zId;
        int iDiv;
        int mAttr = parseMarkup(&markup, z);