Files
discount/markdown.h
T
david parsons c27ea14dd6 Import a mass of changes from boobook
1. Add the new method mkd_string(), which assembles a list from a string.
2. Add a tests directory and three test files.
3. Move the smartypants code out into a separate function, so I can
   (eventually) pass a /don't_be_clever/ flag in to the markdown()
   function.
4. Redo the mail address mangler so I can mangle the
   mailto: as well as the address.
5. Fix a bug in the DELETE() macro in cstring.h
6. Fix dependencies in the Makefile so that a reconfigure forces a
   complete recompile.
7. Code tweaks to make gcc stfu
8. Tweak the build dependencies again.
2007-12-21 12:03:00 -08:00

44 lines
1.2 KiB
C

#ifndef _MARKDOWN_D
#define _MARKDOWN_D
#include "cstring.h"
/* reference-style links (and images) are stored in an array
* of footnotes.
*/
typedef struct footnote {
Cstring tag; /* the tag for the reference link */
Cstring link; /* what this footnote points to */
Cstring title; /* what it's called (TITLE= attribute) */
int height, width; /* dimensions (for image link) */
} Footnote;
/* each input line is read into a Line, which contains the line,
* the offset of the first non-space character [this assumes
* that all tabs will be expanded to spaces!], and a pointer to
* the next line.
*/
typedef struct line {
Cstring text;
struct line *next;
int dle;
} Line;
/* a paragraph is a collection of Lines, with links to the next paragraph
* and (if it's a QUOTE, UL, or OL) to the reparsed contents of this
* paragraph.
*/
typedef struct paragraph {
struct paragraph *next; /* next paragraph */
struct paragraph *down; /* recompiled contents of this paragraph */
struct line *text; /* all the text in this paragraph */
enum { FORCED, CODE=1, QUOTE, MARKUP, HTML, UL, OL, HR } typ;
int para;
enum { LEFT, RIGHT, CENTER} align;
} Paragraph;
extern int mkd_firstnonblank(Line *);
#endif/*_MARKDOWN_D*/