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