mirror of
https://github.com/michaelrsweet/mxml.git
synced 2024-11-13 07:15:30 +00:00
Update markdown anchors to use "title-of-heading" format.
This commit is contained in:
parent
1146488efb
commit
8bdacd119d
@ -1,4 +1,4 @@
|
||||
.TH mxml 3 "Mini-XML API" "05/01/17" "Mini-XML API"
|
||||
.TH mxml 3 "Mini-XML API" "05/02/17" "Mini-XML API"
|
||||
.SH NAME
|
||||
mxml \- Mini-XML API
|
||||
.SH INCLUDE FILE
|
||||
|
6
mmd.c
6
mmd.c
@ -706,7 +706,7 @@ mmd_parse_inline(mmd_t *parent, /* I - Parent node */
|
||||
|
||||
whitespace = 1;
|
||||
}
|
||||
else if (*lineptr == '!' && lineptr[1] == '[')
|
||||
else if (*lineptr == '!' && lineptr[1] == '[' && type != MMD_TYPE_CODE_TEXT)
|
||||
{
|
||||
/*
|
||||
* Image...
|
||||
@ -732,7 +732,7 @@ mmd_parse_inline(mmd_t *parent, /* I - Parent node */
|
||||
whitespace = 0;
|
||||
lineptr --;
|
||||
}
|
||||
else if (*lineptr == '[')
|
||||
else if (*lineptr == '[' && type != MMD_TYPE_CODE_TEXT)
|
||||
{
|
||||
/*
|
||||
* Link...
|
||||
@ -768,7 +768,7 @@ mmd_parse_inline(mmd_t *parent, /* I - Parent node */
|
||||
whitespace = 0;
|
||||
lineptr --;
|
||||
}
|
||||
else if (*lineptr == '<' && strchr(lineptr + 1, '>'))
|
||||
else if (*lineptr == '<' && type != MMD_TYPE_CODE_TEXT && strchr(lineptr + 1, '>'))
|
||||
{
|
||||
/*
|
||||
* Autolink...
|
||||
|
@ -1436,7 +1436,9 @@ markdown_anchor(const char *text) /* I - Title text */
|
||||
for (bufptr = buffer; *text && bufptr < (buffer + sizeof(buffer) - 1); text ++)
|
||||
{
|
||||
if ((*text >= '0' && *text <= '9') || (*text >= 'a' && *text <= 'z') || (*text >= 'A' && *text <= 'Z') || *text == '.' || *text == '-')
|
||||
*bufptr++ = *text;
|
||||
*bufptr++ = (char)tolower(*text);
|
||||
else if (*text == ' ')
|
||||
*bufptr++ = '-';
|
||||
}
|
||||
|
||||
*bufptr = '\0';
|
||||
@ -1597,7 +1599,12 @@ markdown_write_block(FILE *out, /* I - Output file */
|
||||
|
||||
fprintf(out, " <%s><a id=\"", element);
|
||||
for (node = mmdGetFirstChild(parent); node; node = mmdGetNextSibling(node))
|
||||
{
|
||||
if (mmdGetWhitespace(node))
|
||||
fputc('-', out);
|
||||
|
||||
fputs(markdown_anchor(mmdGetText(node)), out);
|
||||
}
|
||||
fputs("\">", out);
|
||||
}
|
||||
else if (element)
|
||||
|
Loading…
Reference in New Issue
Block a user