Skip to content

Double empty lines between headers and list #54

@piranna

Description

@piranna

When setting a list just after a header, there are two empty lines between them, separating them too much, when there should be just a single one. Seems it's due to the fact headers add an newline after them and lists add a newline before them, so when joining the fragments this result in three consecutive newlines. I think it would be better no block add a newline before or after them, and instead the joining add the two ones to create the empty line. This failing test checks it:

    test.it("should add a single newline between headers and ordered lists", function(cb) {
        test.expect(json2md([
            {
                h1: "Heading 1"
            },
            {
                ol: [
                    "item 1", "item 2"
                ]
            }
        ])).toBe("# Heading 1\n\n 1. item 1\n 2. item 2\n");
        cb();
    });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions