jessica parsons
63c7eb3d86
change amalloc so it fills malloc()ed memory with a nun-null pattern, which found a WHOLE BUNCH of places where I was not null-terminating strings but instead was taking advantage of amalloc always zeroing new allocations.
2025-09-08 09:50:17 -07:00
jessica parsons
8ddfb981ef
redo the html5 flag option to make it a per-MMIOT thing, instead of being a global block that we have to deallocate when we're done; also take the opportunity to clean up mkd_initmmiot to have it set fags & html5 extraflags instead of duplicating that code in three places
2025-09-03 17:26:21 -07:00
jessica parsons
5443e322c3
tweak the test for zero in __mkd_io_strget so if it's <=0 it's EOF
2024-10-07 01:28:53 -07:00
jessica parsons
5e2f73aec4
update my name to the current one
2024-03-29 23:41:29 -07:00
david parsons
deca3b64b0
okay, the whole callback structure was a hot mess; change it so that every different callback has its own date & free function
2023-12-13 21:31:04 -08:00
David Seifert
7afa5c6242
Make C99 clean
...
* Clang 16 (and likely GCC 14) will enforce strict C99 semantics
and break old K&R C declarations and require correct C89
function prototypes.
Bug: https://bugs.gentoo.org/870952
Clang: https://discourse.llvm.org/t/configure-script-breakage-with-the-new-werror-implicit-function-declaration/65213/9
2022-10-27 11:08:49 -07:00
david parsons
4a73e7f7d6
have all of the extensions code guarded by checking against MKD_STRICT
2022-10-05 12:22:28 -07:00
david parsons
a0d2a96024
when checking character classes move the utf-8 check in front of all of the other checks; some versions of MSC have a debug mode so if a character isn't either 7-bit ascii or EOF the character class check functions will abort the program. Like, um, yeah, way to creep those standards, people!
2022-05-30 13:32:29 -07:00
david parsons
2739f6de43
messed up pandoc header flagging; it defaulted to NOHEADER in populate()
2022-04-22 02:18:22 -07:00
david parsons
1321a22ecd
first pass at collapsing fenced code blocks into regular paragraphs
2022-04-07 22:36:36 -07:00
david parsons
1003923bca
fix a malloc overflow when doing mkd_anchor_format()
2020-03-28 23:14:23 -07:00
david parsons
c5ea5bbadf
redo the mkd_flag_t set functions to more closely fit how I'm using them and to have more descriptive names
2019-12-08 09:39:23 -08:00
david parsons
9d1b68af38
do more checking for null pointer flags in the published interface
2019-12-08 08:47:09 -08:00
david parsons
eb3cea8983
more cleanup of null pointer dereference crashes during pandoc header processing
2019-10-29 18:41:45 -07:00
david parsons
b9e867b574
redo the whole flags dealie as an opaque blob
2019-12-07 22:49:52 -08:00
david parsons
b52ec440d4
strip out MKD_STRICT as a single flag (convert it into a composite flag that turns off a whole bunch of extensions); use that flagbit to disable github checkbox items, strip out MKD_DLIST as a single flag (convert it into a mask of MKD_DLDISCOUNT|MKD_DLEXTRA, and rework pgm_options so that 'strict' and 'relaxed' apply only to emphasis and 'standard' is the flag that sets & clears flags to make it closer to the standard. Version 3 because I'm fucking with the published interface
2019-04-14 20:56:55 -07:00
david parsons
866e9aaccb
support external code formatters
2019-04-10 11:59:04 -07:00
david parsons
0d33c8fe0d
tweak how scalar headers are include in .in files
2019-02-27 12:10:35 -08:00
david parsons
1f90fde27f
add an anchor format callback, plus add the -x option to the markdown program to squash toc anchors to (close to) github compatability
2019-02-18 20:54:05 -08:00
david parsons
7fdc188f07
clean up all references to flags; define them EVERYWHERE as mkd_flag_t
2018-09-18 08:25:27 -07:00
david parsons
f555d4c1c4
fix all places where I pass flags to be DWORDs
2018-09-14 20:18:17 -07:00
david parsons
06ac2cc08f
if __mkd_trim_line trims the entire line, manually set the string to \0
2018-09-07 15:10:29 -07:00
david parsons
f80d60b89e
in __mkd_trim_line, shortcut a complete line clip by simply setting S() and dle to zero
2018-05-23 10:21:52 -07:00
david parsons
b73576c20e
generalize __mkd_header_dle() into __mkd_trim_line() [trim N characters off the front of a line, adjust the dle] then use it instead of the pair CLIP/firstnonblank to trim & adjust dle
2018-03-10 10:33:57 -08:00
david parsons
b39005d43d
Add a 'dirty' flag to the Document structure & set it whenever a callback
...
changes (github issue #136 ) so that the next mkd_compile will regenerate
the document.
2017-01-28 15:48:00 -08:00
david parsons
feb7505be1
Redo toc anchor generation to reduce namespace collisions (by encoding
...
out of namespace characters to -XX- hex sequences (except space, which
encodes to just -) in html4, %XX in html5 (formerly urlencodedanchor))
and strdup() the buffer in mkd_line() to get it out of my amalloc()
arena if discount is built with amalloc but the surrounding program
isn't.
2017-01-18 18:41:34 -08:00
david parsons
e02a34b8ef
1) messed up the fwrite() error check in mkd_generatehtml,
...
2) return EOF instead of -1 on error in mkd_xhtmlpage,
3) if the mkd output fails, exit with nonzero status
2015-10-26 15:18:16 -07:00
david parsons
6e4190fa65
Handle error conditions and pass errorcodes out of various mkd_xxx output function
...
(inspired by a patch written by Koen Punt <koen@koenpunt.nl >)
2015-10-26 14:43:54 -07:00
Nathan Phillip Brink
5da3388382
Convert urlencodedanchor to a runtime flag for issue #124 .
...
Instead of `./configure.sh --with-urlencoded-anchor`, now use
`-furlencodedanchor` or `MKD_URLENCODEDANCHOR`.
2015-07-13 03:24:31 +00:00
david parsons
196a7aea97
Revert changes that somehow worked their way into the code (patch
...
applied on github that was not pulled to the master. Grr.)
2014-01-22 02:11:17 -08:00
david parsons
22fd0cb385
change domain from pell.chi.il.us to pell.portland.or.us
2014-01-08 16:15:49 -08:00
Daisuke Murase
b6b336e58b
adjust variable types to fit original code
2012-09-03 23:04:21 +09:00
Daisuke Murase
1b65c3e2c3
support url-encoded anchor links with --with-urlencoded-anchor option
2012-09-03 22:59:11 +09:00
david parsons
09945b7393
Create the gfm_string() method that does github flavoured markdown
...
on strings.
2012-05-31 22:37:58 -07:00
david parsons
66ac90e4b6
Add support for github flavoured markdown linebreaks (by adding new
...
functions that pad every input line with two spaces.)
2012-05-30 22:46:46 -07:00
david parsons
6eacbc931b
I macro if(e) into if( (e) ) if gcc or clang are detected
2012-01-24 09:53:51 -08:00
david parsons
57ea29d87f
Add $LFLAGS to the build line for theme
2012-01-19 08:15:28 -08:00
david parsons
f84cbf75a7
In mkd_string_to_anchor(), don't forget that mkd_line() can return EOF
2011-03-21 15:37:49 -07:00
david parsons
b7b3141309
Note the existance of | characters when reading in our input;
...
flagging them here keeps us from calling `memchr()` three(**!**)
times on every line.
2011-03-01 10:23:28 -08:00
david parsons
1eec2c8021
Merge git://github.com/MagLev/discount
2011-02-27 19:15:14 -08:00
Allen Otis
5208c3875a
Change char* to const char* to fix compiler
...
warnings when compiling against Maglev ruby.h
2011-02-26 15:27:54 -08:00
david parsons
92ceec70a8
Revert the ANCHOR_DEFAULT_CHAR code.
2011-02-26 14:20:51 -08:00
david parsons
acdd58b6f0
Add new config options to support old-style table of contents links.
...
--with-id-anchor makes discount use `id=` instead of `a name=`, and
--with-anchor-default=C makes discount use the character C instead of
`.` for illegal characters in anchors.
2011-02-25 22:43:04 -08:00
david parsons
b4ffe19529
Add the mkd_ref_prefix() function to set the prefix for footnotes from fn to some user-supplied value.
2011-02-18 22:16:13 -08:00
david parsons
2b6ea3799e
create a typedef for the function argument to mkd_string_to_anchor, because some
...
compilers (and by some compilers, I mean "gcc") whine bitterly when you pass a
function argument with with a more specific pointer in place of a void*. And if
I can't trust the compiler to emit sensible warnings, I'll just cast the damned
argument to a type that makes it stfu.
In addition, I needed to add prototypes for the html5 tag adder and the two
functions that spit out a list of the flags that the code was compiled with.
2011-01-29 11:00:54 -08:00
david parsons
1b1f8eac17
Add an invisible null to the return value for mkd_line(), so callers
...
can treat the buffer as a C string.
2011-01-01 21:40:37 -08:00
david parsons
4b10998ed1
Redo the internals for pandoc-style headers; don't just carry
...
around a linked list, but pull each field out into its own structure
element.
2010-12-09 14:05:29 -08:00
david parsons
12bb2b959b
Convert all the internal flag bit names so they are the
...
same as the public flag bit names.
2010-10-22 12:59:06 -07:00
david parsons
97a559323e
Redo labelformat to make it more xhtmlable.
...
* if the first character in a label is not alpha, prefix the label with
a "L".
* map every character that's not alphanumeric, "_", "-", ":", or "." into
a ".".
2010-10-22 12:00:13 -07:00
David Parsons
462cbae0da
If STRICT, disallow pandoc headers
2010-10-21 22:01:58 -07:00