diff --git a/scdoc.1.scd b/scdoc.1.scd index 4a7dfcc..012645b 100644 --- a/scdoc.1.scd +++ b/scdoc.1.scd @@ -78,6 +78,23 @@ The result looks like this: - Subitem 2 - Item 3 +You may also extend long entries onto another line by giving it the same indent +level, plus two spaces. They will be rendered as a single list entry. + +``` +- Item 1 is pretty long so let's + break it up onto two lines +- Item 2 is shorter + - But its children can go on + for a while +``` + +- Item 1 is pretty long so let's + break it up onto two lines +- Item 2 is shorter + - But its children can go on + for a while + ## LITERAL TEXT You may turn off scdoc formatting and output literal text with escape codes and diff --git a/src/main.c b/src/main.c index b57c962..e50b1d1 100644 --- a/src/main.c +++ b/src/main.c @@ -193,7 +193,7 @@ static void parse_list(struct parser *p, int *indent) { } list_header(p, "\\(bu"); parse_text(p); - roff_macro(p, "RE", NULL); + bool closed = false; do { parse_indent(p, indent, true); if ((ch = parser_getch(p)) == UTF8_INVALID) { @@ -201,14 +201,21 @@ static void parse_list(struct parser *p, int *indent) { } switch (ch) { case ' ': + if ((ch = parser_getch(p)) != ' ') { + parser_fatal(p, "Expected two spaces for list entry continuation"); + } + parse_text(p); break; case '-': if ((ch = parser_getch(p)) != ' ') { parser_fatal(p, "Expected space before start of list entry"); } + if (!closed) { + roff_macro(p, "RE", NULL); + } list_header(p, "\\(bu"); parse_text(p); - roff_macro(p, "RE", NULL); + closed = false; break; default: fprintf(p->output, "\n"); @@ -216,6 +223,9 @@ static void parse_list(struct parser *p, int *indent) { return; } } while (ch != UTF8_INVALID); + if (!closed) { + roff_macro(p, "RE", NULL); + } } static void parse_literal(struct parser *p, int *indent) {