Fossil

History of src/markdown.c of 97b28feae320b8f1
Login

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

History of file src/markdown.c at check-in 97b28feae320b8f1

2025-12-23
16:06
Assorted fixes of typos and grammar in code comments. No functional changes. file: [ea27e61986] check-in: [e2bdc10572] user: danield branch: trunk, size: 81875
2024-07-03
09:35
Remove the incomplete @tag support. Add some sample inputs to the [/wiki?name=branch/markdown-tagrefs|branch/markdown-tagrefs] page. file: [60b5402b1c] check-in: [4d7c408f52] user: stephan branch: markdown-tagrefs, size: 86648
2024-03-05
12:53
Merge trunk into markdown-tagrefs branch. file: [06f6c068eb] check-in: [0517bd2dd8] user: stephan branch: markdown-tagrefs, size: 87924
2024-02-02
22:18
Remove trailing whitespace from non-external C files. file: [bea2fc4861] check-in: [7db0a2d910] user: danield branch: fix-overlength-lines, size: 81872
16:26
Fix lines over 80 characters long, excluding external source files and @-lines. file: [70a2096d6b] check-in: [942f691b39] user: danield branch: fix-overlength-lines, size: 81875
2024-01-27
21:29
In the markdown formatter, add support for fenced code blocks containing blank lines that are indented. file: [ffb1c7882e] check-in: [5a51d1b4df] user: drh branch: indented-fenced-code-blocks, size: 81866
2023-11-02
12:44
Check if markdown paragraphs contains lists. Fixes issue reported in [forum:b598ac56defddb2a]. file: [5a1ece685c] check-in: [25028896e4] user: preben branch: markdown-multiple-sublists, size: 81164
2023-06-03
08:59
Merge trunk into markdown-tagrefs branch and resolve conflict. file: [105c020c54] check-in: [fdd3fe21c2] user: stephan branch: markdown-tagrefs, size: 87137
2023-03-07
15:40
Remove superfluous makeheaders-targeted declaration of markdown() from markdown.c, since this made it appear twice in the generated header files. file: [4ab8b1749c] check-in: [bb583b0cc4] user: danield branch: trunk, size: 81085
2023-02-17
14:37
A large collection of compiler warning fixes re. signed/unsigned comparison from Daniel D. file: [37d5897bd3] check-in: [c71f711ec9] user: stephan branch: compiler-warnings, size: 81341
2022-09-15
17:48
Merge trunk into markdown-tagrefs branch. file: [c014e6eab3] check-in: [8ef0347fd3] user: stephan branch: markdown-tagrefs, size: 87298
2022-06-22
12:35
Fix a minor footnotes-related bug that was discovered by Stephan: if a free-standing footnote reference follows immediately after the exclamation mark then parse that as a footnote (and not as an image). This check-in also postpones initialization of a few local variables within <code>char_link()</code> function (which may save a few CPU cycles). file: [c2daecf6e2] check-in: [97b28feae3] user: george branch: trunk, size: 81246
2022-06-11
12:34
Merged in trunk. file: [37ad9cd4a8] check-in: [fd14e7ec62] user: stephan branch: markdown-tagrefs, size: 87203
2022-04-25
00:05
Fix a C++-ism in the new markdown code that breaks the build on older PIs. file: [13fcec9f56] check-in: [b7471a4bee] user: drh branch: trunk, size: 81151
2022-04-24
22:46
Merged in trunk, resolved conflicts introduced via the parallel development of the markdown-footnotes branch. file: [640fbc4500] check-in: [64af75b070] user: stephan branch: markdown-tagrefs, size: 87201
2022-04-23
17:23
Change signature of <code>add_inline_footnote()</code> in order to move away from returning of unreliable pointer. Amend a few comments. Fix a couple of minor issues that fuzzer complains about. file: [15df91dc48] check-in: [0850862e6a] user: george branch: markdown-footnotes, size: 81149
15:56
Fix a possible heap-buffer-overflow in <code>parse_htmlblock()</code> introduced by [1e919d601f774fdb]. This is not related to footnotes but was revealed by fuzzing (case 80cbb6b185807e98a953426af7b1f802c9d13957). file: [2594903eec] check-in: [bc4c5b6311] user: george branch: markdown-footnotes, size: 81142
2022-04-21
21:13
Fix another use-after-realloc bug in handling of inline footnotes which was discovered during fuzzing. Also fix a few other issues revealed via fuzzer. file: [75ea36a490] check-in: [c5456211f4] user: george branch: markdown-footnotes, size: 81112
13:16
Fix a use-after-free bug in handling of nested inline footnotes. The bug was discovered by fuzzing with <code>'-fsanitize=fuzzer,undefined,address -DFOSSIL_FUZZ'</code> appended to <var>TCCFLAGS</var> in Makefile.in. It's noteworthy that the <code>',undefined,address'</code> part was essential to find the bug (otherwise just 'double-free' was reported). Many thanks to Stephan for documenting the fuzzing procedures and support. file: [c7ef8c8513] check-in: [31e5df5fa2] user: george branch: markdown-footnotes, size: 80854
2022-04-20
14:07
Added a missing blob initializer. file: [47d8f8fc60] check-in: [7209593814] user: stephan branch: markdown-footnotes, size: 80805
2022-04-19
12:35
Code style tweaks, typos, and resolved a couple footnotes-related cosmetic TODOs. No functional changes. file: [70b8501712] check-in: [3a5b3d5e49] user: stephan branch: markdown-footnotes, size: 80732
2022-02-23
12:33
Count overnesting as the fourth type of the footnote-related issues and report accordingly. file: [4e0646a55c] check-in: [ae297bb671] user: george branch: markdown-footnotes, size: 80400
09:45
Minor refactoring. Move the definition of <code>BLOB_APPEND_LITERAL()</code> macro from <code>markdown_html.c</code> to <code>blob.c</code> so that it could be used outside of <code>markdown_html.c</code>. Also rename it to lowercase for consistency with other API. Within <code>markdown.c</code> use that newly available macro instead of <code>blob_append_string()</code>. Within <code>markdown_html.c</code> use it for footnotes-relevant code. Other invocations of <code>BLOB_APPEND_LITERAL()</code> within <code>markdown_html.c</code> are left intact (they use an alias) in order to simplify the potential merge with the trunk. file: [c30c2629fb] check-in: [c8a8d0c94c] user: george branch: markdown-footnotes, size: 80276
08:21
Minor refactoring. Move the definition of <code>BLOB_APPEND_BLOB()</code> macro from <code>markdown_html.c</code> to <code>blob.c</code> so that it could be used outside of <code>markdown_html.c</code>. Also rename it to <code>blob_appendb()</code> for consistency with <code>blob_appendf()</code> and other API. Within <code>markdown.c</code> use that newly available macro where appropriate. Within <code>markdown_html.c</code> use it for footnotes-relevant code. Other invocations of <code>BLOB_APPEND_BLOB()</code> within <code>markdown_html.c</code> are left intact (they use an alias) in order to simplify the potential merge with the trunk. file: [953f6441e7] check-in: [33a681ebee] user: george branch: markdown-footnotes, size: 80272
07:36
Fix handling of user-provided classes for unreferenced, joined and overnested footnotes. In all these cases the tokens of user-provided classes are rendered as plain-text and no special classes are added anywhere. file: [5d8d9fe4c4] check-in: [875472a8b0] user: george branch: markdown-footnotes, size: 80467
2022-02-21
05:14
Add a comment for <code>append_footnote_upc()</code>. Also substitute a variable of zero value with just "0" constant. No functional changes. file: [968d831b72] check-in: [ae8a3dd5aa] user: george branch: markdown-footnotes, size: 79864
04:29
Impose a limit on the depth of nesting of inline footnotes. Also add a few test cases: for depth limiting and HTML hijacking. file: [d9ea0b47dc] check-in: [f4ff013ace] user: george branch: markdown-footnotes, size: 79871
2022-02-20
23:00
If there are issues with footnotes then set TH1 variable <var>$footnotes_issues_counters</var> to a space separated list of integers that count for "misref", "unref" and "joins". This eliminates the need for JavaScript for the case when a custom skin wants to [forum:/forumpost/119b0be29a2b096b|warn about issues with footnotes] in the header of a page.<br> Also fix counting of "joins": count the number of unique labels that have multiple definitions (and not the number of such definitions). file: [1e145862d9] check-in: [773cef5cf7] user: george branch: markdown-footnotes, size: 79832
2022-02-19
01:16
Parse inline footnotes even if a renderer does not define a callback for rendering of footnote markers. This seems more correct even though the current implementation of backlink processor does define such callback as an empty function. file: [18387c88eb] check-in: [e06c12d176] user: george branch: markdown-footnotes, size: 79867
01:00
Handle some corner cases more thoroughly: dismiss empty footnotes, passthrough (more carefully) user-provided classlist if the token is not followed by a blank character or if a footnote's text consists just of such token and blank characters. Also simplify a little bit a few places inside of <code>is_footnote()</code> function. file: [373b9c3971] check-in: [fe3157803f] user: george branch: markdown-footnotes, size: 79854
2022-02-18
01:33
Add <code>--lint-footnotes</code> option to the <code>test-markdown-render</code> command. If this flag is given and footnotes in the input have issues, then print to <var>stderr</var> the counters of "misrefs", "strays" and "split-defs" and exit with error. This should partially address a concern [forum:/forumpost/119b0be29a2b096b|raised at the forum]. file: [f121314916] check-in: [1f525713ff] user: george branch: markdown-footnotes, size: 79677
2022-02-17
22:09
If a footnote's text starts with a token of the special form then use this token to derive a set of CSS classes that are added to that footnote and its references. This enables users to style elements of a particular footnote provided that the administrator provisioned and documented some special CSS classes in a custum skin. Default skin does not provide any of such special classes which makes this feature an "opt-in". file: [8ae95ea4f1] check-in: [92516ced8b] user: george branch: markdown-footnotes, size: 79563
00:17
Clean-up and rephrase some comments. file: [e26323e6c7] check-in: [a62c876896] user: george branch: markdown-footnotes, size: 76265
2022-02-16
23:08
Make parsing slightly faster and fix a comment. No changes in functionality. file: [d437ef43e9] check-in: [a36dd09d17] user: george branch: markdown-footnotes, size: 76224
2022-02-14
23:32
Minor code refactoring: rename a temporary variable and utilize <code>matching_bracket_offset()</code> one more time. No changes in functionality. file: [ab91a58a78] check-in: [5b845a0790] user: george branch: markdown-footnotes, size: 76220
2022-02-13
19:29
Fix parsing of "free-standing" footnotes that was (slightly) broken by the previous check-in. file: [b3d1215592] check-in: [23c3e0b2a7] user: george branch: markdown-footnotes, size: 76415
2022-02-12
20:52
If markup is ambigous between a "span-bounded" footnote and a "free-standing" footnote followed by another footnote then interpret as the later case. file: [74a97a7a94] check-in: [b363a4dbe7] user: george branch: markdown-footnotes, size: 76351
2022-02-11
01:26
Fix parsing of a multiline definition of labeled footnote for the case when lines end with CR+LF. file: [e4660a1374] check-in: [ea66d15cf3] user: george branch: markdown-footnotes, size: 76344
2022-02-10
23:00
Clean-up and polish relevant CSS and HTML's class names. Insure visual spacing between footnotes' markers so that numbers are distinguishable when multiple footnotes in a row are used. Factor out auxiliary decorations from HTML into the default CSS, to enable customization via skins. file: [bf7a5dad88] check-in: [2b1375abad] user: george branch: markdown-footnotes, size: 76350
2022-02-09
22:59
Handle unreferenced footnotes. If a labeled footnote is defined but there are no references to it, then add a special item at the end of footnotes. This item includes a label and the text of the strayed footnote - both rendered verbatim via <tt>html_escape()</tt>. Default skin makes such items visible and easily distinguishable. The order of such items match the order in the underlying source code. file: [6996865f1d] check-in: [ada55cd45a] user: george branch: markdown-footnotes, size: 76280
20:09
Join duplicated footnotes slightly faster. Fix a comment about auxiliary <tt>cmp_footnote_id()</tt> function. file: [e6d28d306d] check-in: [7f6a641808] user: george branch: markdown-footnotes, size: 75990
2022-02-08
14:09
An attempt to fix a "double free crash" from the previous check-in. file: [1acc8925d8] check-in: [18c9d10368] user: george branch: markdown-footnotes, size: 76303
14:04
If several footnotes are defined with the same label then join them into a single footnote. Text from each definition becomes an item in the list. This solution makes such situations noticable for the usual case (when this is an oversight) but also not obtrusive for the rare cases (when this is intentional). The list is provided with a special class to enable styling via skin customization.<br><b>This check-in is known to cause crash, see the forthcoming check-in.</b> file: [84dbba2fcd] check-in: [544df852b2] user: george branch: markdown-footnotes, size: 76037
2022-02-06
22:53
Handle misreferences more thoroughly. Implement support of footnotes-within-footnotes with (hopefully) proper crosslinking (that's where it's getting tricky). file: [954e6b45cb] check-in: [1787f6df11] user: george branch: markdown-footnotes, size: 73864
2022-02-04
23:07
Handle misreferences: a reference to undefined footnote. file: [9dc1506aa1] check-in: [28e6a9cd13] user: george branch: markdown-footnotes, size: 71653
19:47
Minor code refactoring. file: [0d965359f5] check-in: [2636e2245e] user: george branch: markdown-footnotes, size: 71203
00:37
Switch to <tt>(^...)</tt> for inline footnotes. Implement span-specific footnotes. Add [/doc/markdown-footnotes/src/markdown.md#ftnts|documentation]. file: [eb33ca24bd] check-in: [cae7a5d1ca] user: george branch: markdown-footnotes, size: 71114
2022-02-02
17:50
Bug-fix: Do not loose referenced footnotes when inline footnotes are also used. file: [2ad62938c4] check-in: [a8f0f1e7ff] user: george branch: markdown-footnotes, size: 68914
2022-02-01
20:12
Support multiline footnote definitions and inline footnotes via <tt>^[...]</tt> syntax (this syntax is not settled yet). Fix overall link support that was broken by [e3710ccd3a5a]. file: [0a68c6c568] check-in: [78b7846b8e] user: george branch: markdown-footnotes, size: 68883
2022-01-29
00:19
Decouple parsing and HTML-specific rendering. Add support for back references in the list of footnotes. WIP - inline and multiline footnotes are not yet implemented. file: [978d12915b] check-in: [e3710ccd3a] user: george branch: markdown-footnotes, size: 67543
2022-01-27
19:45
Minor code clean-up of src/markdown.c: add a few 'const' specifiers, reduce the scope of temporary variables and simplify their names. file: [ec63fe50a0] check-in: [b9393a4e64] user: george branch: markdown-footnotes, size: 66555
2022-01-26
14:50
Initial support for [forum:/forumthread/d752446a4f63f390|footnotes in Markdown]. <br>This is WIP: support of multiline notes and code clean-up are pending. file: [cbc06582a2] check-in: [ebce0f357e] user: george branch: markdown-footnotes, size: 66600
2021-10-05
17:31
Any non-ASCII characters are now considered valid for use in hashtags. file: [688ac5fa2c] check-in: [4f68a1306f] user: stephan branch: markdown-tagrefs, size: 67433
2021-09-25
12:26
Added #NNN and #NNN.NNN references as a special case of hashtag, noting that it will currently match a prefix of #NNN.NNN.NNN. Taught /chat that clicking on such a reference should jump to the referenced message or toast the user that the message is not in the current history. file: [1d8a3180e0] check-in: [4539bf8792] user: stephan branch: markdown-tagrefs, size: 66938
08:17
More progress on the markdown #hashtag parsing. file: [0568503019] check-in: [ac5b66bb40] user: stephan branch: markdown-tagrefs, size: 66059
07:20
Merged in latest trunk. test-markdown-render now accepts files and string literals. file: [009d9faad6] check-in: [5618cceb7b] user: stephan branch: markdown-tagrefs, size: 63982
2021-09-21
17:36
Removed a bogus unreached return statement. file: [96673d245d] check-in: [4b98f9e791] user: stephan branch: markdown-tagrefs, size: 63954
17:34
More refinement of the token selection for #hashtag and @name references. file: [ef6a6228ba] check-in: [3363ab42c0] user: stephan branch: markdown-tagrefs, size: 63966
16:42
Fixed a paren nesting bug that prevented multi-character hashtags from being processed. It would stop at the second character. file: [74510ffe03] check-in: [e211f1ab42] user: wyoung branch: markdown-tagrefs, size: 62741
16:19
Initial implementation of "span data-foo" wrappers around @name and #tag references. Seems functional on a test-markdown-render basis, but the definitions of what counts as a reference and what to do with them still remains to be handled. file: [2bb9f9b921] check-in: [31a607d33c] user: wyoung branch: markdown-tagrefs, size: 62741
2021-09-19
07:28
Applied patch from Warren at [forum:26371e6b32cb4ebc] to resolve the new behavior of markdown catching message prefixes of #NNN as a header. file: [517e31d3c4] check-in: [408d584e21] user: stephan branch: chat-markdown, size: 61300
2021-08-12
14:38
Correctly handle block HTML in markdown if the end tag occurs at the very end of the input without even a new-line. file: [dc0382d692] check-in: [a06f3379f0] user: drh branch: trunk, size: 61234
2021-08-09
01:11
Markdown enhancement (after [forum:/forumpost/938896d37da30394|forum post 938896d37da30394] and follow-ups) in which &lt;html&gt;...&lt;/html&gt; that is preceded and followed by blank lines disables all markdown processing and just returns raw HTML text. The &lt;html&gt; and its end-tag are removed. Removal of "dangerous" HTML is handled in a later pass, so the results should still be safe. file: [15f2ba17d1] check-in: [1e919d601f] user: drh branch: trunk, size: 61236
2021-08-07
10:33
Fix an uninitialized variable resulting from check-in [cdbf0bf179989a2d]. file: [176762091a] check-in: [a099ccfe92] user: drh branch: trunk, size: 60964
2021-08-06
23:23
Simplify the HTML block tag handling in the markdown formatter. (See [forum:/forumpost/3f0136cd8054a14e|forum thread 3f0136cd80].) Dramatically reduce the number of of HTML block tags that do not apply markdown formatting to their content. The list is now just &lt;pre&gt; and &lt;script&gt;. Formerly this list include things like &lt;p&gt; and &lt;table&gt;. file: [7f9a955752] check-in: [cdbf0bf179] user: drh branch: trunk, size: 60951
2020-11-20
14:39
Fix a markdown rendering bug reported by [forum:/forumpost/da5c5c4c31|forum post da5c5c4c31]. file: [ef2fd91cee] check-in: [b4e50e9ace] user: drh branch: trunk, size: 61924
2020-09-15
18:20
Enable automatic paragraph numbering in Markdown using a special HTML comment: "&lt;--markdown paragraph-numbers=on --&gt;" file: [76c4508b29] check-in: [d9a70a1df9] user: drh branch: auto-toc, size: 61915
15:43
Fix the markdown converter so that it recognizes HTML comments and passes them through into the raw_html_tag callback. file: [72dbe46278] check-in: [881f86645a] user: drh branch: trunk, size: 61913
2020-08-19
01:33
Restore blank cell capability, fixes [95ce0e53] file: [1dc6457837] check-in: [dc94ebc2cd] user: andygoth branch: trunk, size: 61731
2020-06-11
21:03
In the Markdown formatter, bring emphasis markup into closer alignment with the CommonMark spec. In particular, this should allow underscores in the middle of identifiers to be rendered correctly without escapes. file: [5a1fb3e55d] check-in: [37806e85d2] user: drh branch: trunk, size: 61730
2020-06-01
20:51
Optimization to markdown formatting - faster determination if a line is part of a table for the common case when it is not. file: [b11ff3c334] check-in: [bd2796b10a] user: drh branch: trunk, size: 60224
07:01
Enhance the markdown formatter to ignore certain HTML tags such as &lt;style&gt;. file: [9c180f0379] check-in: [a3ab0c6186] user: drh branch: trunk, size: 60417
2020-05-26
15:54
Attempt to fix markdown rendering so that it correctly ignores table column separators that are contained without "code-span" back-ticks. file: [e7cff55ab2] check-in: [d6058989ed] user: drh branch: trunk, size: 60190
2019-09-24
23:29
Performance optimizations in the markdown formatter. file: [0d50047950] check-in: [ef41fbfa59] user: drh branch: trunk, size: 59368
20:27
Create and use the blob_append_string() macro for appending string literals. Improvements to blob_append_char(). file: [02e8700469] check-in: [48c47e1eb7] user: drh branch: trunk, size: 58826
18:16
Additional efforts to limit depth of recursion in markdown. file: [e7e1096993] check-in: [cd5e9f265d] user: drh branch: trunk, size: 58816
18:04
Attempt to limit the depth of recursion in markdown formatting. file: [94c4775ba8] check-in: [a5835cac3b] user: drh branch: trunk, size: 58651
15:12
Simplification of buffer management in the markdown formatter. file: [05c76e6940] check-in: [f8e9197de4] user: drh branch: trunk, size: 58391
10:34
Fix a memory leak in the markdown renderer. file: [15506a5ea6] check-in: [199b20d0e1] user: drh branch: trunk, size: 60020
2019-09-23
23:18
Fix a potential bug in the table parsing logic of markdown rendering. file: [dbbf6ab263] check-in: [2263cf086e] user: drh branch: trunk, size: 60001
21:06
Fix a potential endless loop in the markdown formatter. Enhance the fuzzer to run inputs on both the Fossil-wiki and the markdown formatters on each iteration. file: [6ac805fc4f] check-in: [4b46fb91e3] user: drh branch: trunk, size: 59977
2019-08-09
15:57
Further work on the fenced code blocks of markdown. Allow blank lines in the middle of a fenced code block. And also allow ~ character (three or more) to serve as the delimiter for fenced code blocks. file: [8f0616a9e7] check-in: [c7600da489] user: drh branch: trunk, size: 59945
2019-08-08
20:35
A triple grave accent quoted text (```....```) in markdown is rendered as &lt;pre&gt;...&lt;/pre&gt;. file: [25d57b88b1] check-in: [2077ffe660] user: drh branch: trunk, size: 59491
2019-03-30
00:46
Support both "1)" and "1." for numbered lists in markdown, as commonmark does. Patch from A. Kupries. file: [fa512af144] check-in: [9d6a0aac42] user: drh branch: trunk, size: 59473
2018-03-20
17:08
The markdown processor should use the Fossil memory allocation routines. file: [a26e6a0b9e] check-in: [e382cae5c1] user: mistachkin branch: trunk, size: 59455
2017-03-14
16:02
Fix by Natacha Porté for delimiter escape bug discovered by Mark Janssen. (fossil-users list) file: [2cb7007279] check-in: [dd41f85acf] user: jan.nijtmans branch: trunk, size: 59441
2016-11-04
22:37
Consistently use the count(X) macro in place of sizeof(X)/sizeof(*X) throughout the Fossil core, excluding things that don't use makeheaders. Also use count(X) instead of ArraySize(X) which has the same definition. file: [20bb4755f2] check-in: [e5b62edb28] user: andygoth branch: trunk, size: 59440
2016-06-21
20:03
Fix typos in comments. file: [887bb75edb] check-in: [243fc6c246] user: drh branch: trunk, size: 59465
2015-02-11
18:13
Change blob_zero() calls to blob_reset() in markdown.c. Fix over-length lines in markdown.c. file: [c740cc81a2] check-in: [736006d121] user: drh branch: trunk, size: 59470
2014-12-19
12:51
Fix a compiler warning in markdown.c that occurs only with -Os on gcc. file: [a8ea5a5012] check-in: [623057ea59] user: drh branch: trunk, size: 59450
2014-09-07
19:50
More proposed fixes to the issues pointed out by Edward Berner. file: [3b30a917f0] check-in: [4429a4c3cc] user: mistachkin branch: warningFixes, size: 59446
2014-01-27
08:23
Put html_tag const table (from markdown implementation) in constant memory. file: [717f7f1492] check-in: [7c4414ca10] user: jan.nijtmans branch: trunk, size: 59446
2013-04-01
16:12
Remove unused variable file: [4118a71bae] check-in: [5a920d726b] user: jan.nijtmans branch: trunk, size: 59398
2013-03-29
15:43
Enable markdown by default. Render as markdown any document that ends with either "md" or "markdown". file: [9b589c858e] check-in: [02f312e698] user: drh branch: markdown, size: 59414
2012-12-08
01:01
In the markdown engine, use fossil_strnicmp() to allow easy compilation with MSVC. file: [8e73e822c9] check-in: [3ad20f4b25] user: mistachkin branch: trunk, size: 59486
2012-10-03
19:54
Added: Integration work for the markdown engine provided by Natacha Porté. file: [d79f134a52] check-in: [d38c6eef06] user: mistachkin branch: markdown, size: 59466