Skip to content

--EOL option does not properly handle @example tag line endings #102

Closed
@kevlon85

Description

@kevlon85

As explained in #92, when generating markdown from JS files with CRLF line endings the output is produced with mixed line endings.

As is the recommended fix for that issue I tried using the new --EOL option to force the output to use consistent line endings. However this option does not seem to be fully working as expected.

When I run jsdoc2md test.js --EOL win32 > README.md over the following code saved with CRLF line endings:

/**
 * Adds two numbers.
 * @param {number} a The first number to be added.
 * @param {number} b The second number to be added.
 * @returns {number} The sum of a and b.
 * @example
 * let a = 1;
 * let b = 2;
 * // returns 3
 * add(a, b);
 */
function add(a, b) {
    return a + b;
}

it correctly outputs the line endings for everything except multiline @example tags where it instead outputs just carriage returns.

image

The same thing happens when running with option --EOL posix.

jsdoc2md test.js --EOL posix > README.md:

image

These same commands generate the expected output (completely consistent line encodings) when the input file is saved using LF line encodings.

This causes problems as not all markdown renderers render a carriage return on its own as a new line which means the examples get squashed onto one line.

I am using jsdoc-to-markdown version 9.0.1 and dmd version 7.0.6 on Windows 11.

Let me know if you are unable to reproduce this or if there is any more information I can provide.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions