Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions markdown.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ int main(int argc, char * argv[]) {
static gboolean opt_notes = FALSE;
static gboolean opt_filter_html = FALSE;
static gboolean opt_filter_styles = FALSE;
static gboolean opt_hardwrap = FALSE;
static gboolean opt_allext = FALSE;

static GOptionEntry entries[] =
Expand All @@ -87,8 +88,9 @@ int main(int argc, char * argv[]) {
/* Options to active syntax extensions. These appear separately in --help. */
static GOptionEntry ext_entries[] =
{
{ "smart", 0, 0, G_OPTION_ARG_NONE, &opt_smart, "use smart typography extension", NULL },
{ "notes", 0, 0, G_OPTION_ARG_NONE, &opt_notes, "use notes extension", NULL },
{ "smart", 0, 0, G_OPTION_ARG_NONE, &opt_smart, "use smart typography extension", NULL },
{ "notes", 0, 0, G_OPTION_ARG_NONE, &opt_notes, "use notes extension", NULL },
{ "hardwrap", 0, 0, G_OPTION_ARG_NONE, &opt_hardwrap, "respect linebreaks in paragraphs", NULL },
{ NULL }
};

Expand Down Expand Up @@ -127,6 +129,8 @@ int main(int argc, char * argv[]) {
extensions = extensions | EXT_FILTER_HTML;
if (opt_filter_styles)
extensions = extensions | EXT_FILTER_STYLES;
if (opt_hardwrap)
extensions = extensions | EXT_HARD_WRAP;

if (opt_to == NULL)
output_format = HTML_FORMAT;
Expand Down
3 changes: 2 additions & 1 deletion markdown_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ enum markdown_extensions {
EXT_SMART = 0x01,
EXT_NOTES = 0x02,
EXT_FILTER_HTML = 0x04,
EXT_FILTER_STYLES = 0x08
EXT_FILTER_STYLES = 0x08,
EXT_HARD_WRAP = 0x40
};

enum markdown_formats {
Expand Down
2 changes: 1 addition & 1 deletion markdown_parser.leg
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ NormalEndline = Sp Newline !BlankLine !'>' !AtxStart
TerminalEndline = Sp Newline Eof
{ $$ = NULL; }

LineBreak = " " NormalEndline
LineBreak = ( " " NormalEndline | &{ extension(EXT_HARD_WRAP) } NormalEndline )
{ $$ = mk_element(LINEBREAK); }

Symbol = < SpecialChar >
Expand Down