Skip to content

Autodoc: empty lines are being rendered after the each docstring line in the source code page #21360

Closed

Description

@prajwalch

Zig Version

0.14.0-dev.1510+fb0028a0d

Steps to Reproduce and Observed Behavior

Given a function:

/// Appends the new subcommand to the list of subcommands.
///
/// ## Examples
///
/// ```zig
/// var app = App.init(allocator, "myapp", "My app description");
/// defer app.deinit();
///
/// var root = app.rootCommand();
///
/// var test = app.createCommand("test", "Run test");
/// try test.addArg(Arg.positional("FILE", null, null));
///
/// try root.addSubcommand(test);
/// ```
pub fn addSubcommand(self: *Command, new_subcommand: Command) !void { ... }

This is what the source code of it looks like in the source page:
image

Expected Behavior

I expected correct rendering :)

Activity

  1. added
    bugObserved behavior contradicts documented or intended behavior
    on Sep 9, 2024
  2. Vexu commented on Sep 9, 2024

    @Vexu
    Member

    Can't reproduce on 0.14.0-dev.1513+de8cece6e with zig build-exe a.zig -femit-docs:

    /// Appends the new subcommand to the list of subcommands.
    ///
    /// ## Examples
    ///
    /// ```zig
    /// var app = App.init(allocator, "myapp", "My app description");
    /// defer app.deinit();
    ///
    /// var root = app.rootCommand();
    ///
    /// var test = app.createCommand("test", "Run test");
    /// try test.addArg(Arg.positional("FILE", null, null));
    ///
    /// try root.addSubcommand(test);
    /// ```
    pub fn main() void {
    }
    

    image

  3. prajwalch commented on Sep 9, 2024

    @prajwalch
    Author

    Uh, let me try one more time. By the way, which OS are you on?

    Update: Got the same result. I am generating docs with zig test src/lib.zig and this is what lib.zig contains.

    image

    Update: I am on Windows.

  4. Vexu commented on Sep 9, 2024

    @Vexu
    Member

    Does it reproduce on the snippet I gave? And I'm on Linux.

  5. prajwalch commented on Sep 9, 2024

    @prajwalch
    Author

    Does it reproduce on the snippet I gave? And I'm on Linux.

    It doesn't.

    Update: Also, the issue #21358 is not reproduced on the snippet you gave it to me.

  6. pfgithub commented on Sep 9, 2024

    @pfgithub
    Contributor

    Both issues reproduce for me if carriage returns are inserted before every newline

    image

    image

  7. prajwalch commented on Sep 10, 2024

    @prajwalch
    Author

    Yes! Changing the CRLF to LF solves the problem.

  8. added a commit that references this issue on Sep 10, 2024
    b482af8
  9. added
    autodocThe web application for interactive documentation and generation of its assets.
    on Sep 10, 2024
  10. added this to the 0.14.0 milestone on Sep 10, 2024
  11. added a commit that references this issue on Sep 24, 2024
    b473123
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    autodocThe web application for interactive documentation and generation of its assets.bugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions