Fossil SCM

Fix minor issues with markdown rendering in wiki.

drh 2025-03-05 20:52 comment-markdown-links
Commit 4be82a52a558b11a2032e5e7411ca672d562fc10e5de33fb49f8a20788504ae1
1 file changed +5 -3
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -1683,11 +1683,11 @@
16831683
&& (zEnd = strchr(z+n+1,')'))!=0
16841684
){
16851685
/* Markdown-style hyperlinks: [display-text](URL) or [](URL) */
16861686
if( n>2 ){
16871687
zDisplay = &z[1];
1688
- z[n] = 0;
1688
+ z[n-1] = 0;
16891689
}else{
16901690
zDisplay = 0;
16911691
}
16921692
zTarget = &z[n+1];
16931693
for(i=n+1; z[i] && z[i]!=')' && z[i]!=' '; i++){}
@@ -1733,12 +1733,14 @@
17331733
case TOKEN_BACKSLASH: {
17341734
if( (p->state & WIKI_MARKDOWN_FONT)==0 ){
17351735
/* Ignore backslashes in traditional Wiki */
17361736
blob_append_char(p->pOut, '\\');
17371737
n = 1;
1738
- }else{
1738
+ }else if( (z[1]&0x80)!=0 ){
17391739
blob_append_char(p->pOut, z[1]);
1740
+ }else{
1741
+ blob_appendf(p->pOut,"&#%d;", z[1]);
17401742
}
17411743
break;
17421744
}
17431745
case TOKEN_MDCODE: {
17441746
if( (p->state & WIKI_MARKDOWN_FONT)==0 ){
@@ -2087,11 +2089,11 @@
20872089
** --text Run the output through html_to_plaintext().
20882090
** --tokenize Output a tokenization of the input file
20892091
*/
20902092
void test_wiki_render(void){
20912093
Blob in, out;
2092
- int flags = 0;
2094
+ int flags = ALLOW_LINKS;
20932095
int bText, bTokenize;
20942096
if( find_option("buttons",0,0)!=0 ) flags |= WIKI_BUTTONS;
20952097
if( find_option("htmlonly",0,0)!=0 ) flags |= WIKI_HTMLONLY;
20962098
if( find_option("linksonly",0,0)!=0 ) flags |= WIKI_LINKSONLY;
20972099
if( find_option("nobadlinks",0,0)!=0 ) flags |= WIKI_NOBADLINKS;
20982100
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -1683,11 +1683,11 @@
1683 && (zEnd = strchr(z+n+1,')'))!=0
1684 ){
1685 /* Markdown-style hyperlinks: [display-text](URL) or [](URL) */
1686 if( n>2 ){
1687 zDisplay = &z[1];
1688 z[n] = 0;
1689 }else{
1690 zDisplay = 0;
1691 }
1692 zTarget = &z[n+1];
1693 for(i=n+1; z[i] && z[i]!=')' && z[i]!=' '; i++){}
@@ -1733,12 +1733,14 @@
1733 case TOKEN_BACKSLASH: {
1734 if( (p->state & WIKI_MARKDOWN_FONT)==0 ){
1735 /* Ignore backslashes in traditional Wiki */
1736 blob_append_char(p->pOut, '\\');
1737 n = 1;
1738 }else{
1739 blob_append_char(p->pOut, z[1]);
 
 
1740 }
1741 break;
1742 }
1743 case TOKEN_MDCODE: {
1744 if( (p->state & WIKI_MARKDOWN_FONT)==0 ){
@@ -2087,11 +2089,11 @@
2087 ** --text Run the output through html_to_plaintext().
2088 ** --tokenize Output a tokenization of the input file
2089 */
2090 void test_wiki_render(void){
2091 Blob in, out;
2092 int flags = 0;
2093 int bText, bTokenize;
2094 if( find_option("buttons",0,0)!=0 ) flags |= WIKI_BUTTONS;
2095 if( find_option("htmlonly",0,0)!=0 ) flags |= WIKI_HTMLONLY;
2096 if( find_option("linksonly",0,0)!=0 ) flags |= WIKI_LINKSONLY;
2097 if( find_option("nobadlinks",0,0)!=0 ) flags |= WIKI_NOBADLINKS;
2098
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -1683,11 +1683,11 @@
1683 && (zEnd = strchr(z+n+1,')'))!=0
1684 ){
1685 /* Markdown-style hyperlinks: [display-text](URL) or [](URL) */
1686 if( n>2 ){
1687 zDisplay = &z[1];
1688 z[n-1] = 0;
1689 }else{
1690 zDisplay = 0;
1691 }
1692 zTarget = &z[n+1];
1693 for(i=n+1; z[i] && z[i]!=')' && z[i]!=' '; i++){}
@@ -1733,12 +1733,14 @@
1733 case TOKEN_BACKSLASH: {
1734 if( (p->state & WIKI_MARKDOWN_FONT)==0 ){
1735 /* Ignore backslashes in traditional Wiki */
1736 blob_append_char(p->pOut, '\\');
1737 n = 1;
1738 }else if( (z[1]&0x80)!=0 ){
1739 blob_append_char(p->pOut, z[1]);
1740 }else{
1741 blob_appendf(p->pOut,"&#%d;", z[1]);
1742 }
1743 break;
1744 }
1745 case TOKEN_MDCODE: {
1746 if( (p->state & WIKI_MARKDOWN_FONT)==0 ){
@@ -2087,11 +2089,11 @@
2089 ** --text Run the output through html_to_plaintext().
2090 ** --tokenize Output a tokenization of the input file
2091 */
2092 void test_wiki_render(void){
2093 Blob in, out;
2094 int flags = ALLOW_LINKS;
2095 int bText, bTokenize;
2096 if( find_option("buttons",0,0)!=0 ) flags |= WIKI_BUTTONS;
2097 if( find_option("htmlonly",0,0)!=0 ) flags |= WIKI_HTMLONLY;
2098 if( find_option("linksonly",0,0)!=0 ) flags |= WIKI_LINKSONLY;
2099 if( find_option("nobadlinks",0,0)!=0 ) flags |= WIKI_NOBADLINKS;
2100

Keyboard Shortcuts

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