diff --git a/doc/migration.md b/doc/migration.md index 4293737..257e40e 100644 --- a/doc/migration.md +++ b/doc/migration.md @@ -97,8 +97,7 @@ If arguments require more complex documentation consider starting an extra secti # Arguments - ## **x** - + ## **x** (Any) (...Some comprehensive documentation) */ diff --git a/src/format.rs b/src/format.rs index 6d9efff..11888fa 100644 --- a/src/format.rs +++ b/src/format.rs @@ -64,11 +64,11 @@ pub fn handle_indentation(raw: &str) -> Option { /// pub fn shift_headings(raw: &str, levels: usize) -> String { let mut result = String::new(); - for line in raw.lines() { + for line in raw.split_inclusive('\n') { if line.trim_start().starts_with('#') { - result.push_str(&format!("{}\n", &handle_heading(line, levels))); + result.push_str(&handle_heading(line, levels)); } else { - result.push_str(&format!("{line}\n")); + result.push_str(line); } } result diff --git a/src/snapshots/nixdoc__test__doc_comment.snap b/src/snapshots/nixdoc__test__doc_comment.snap index 23ce5c9..c69cec1 100644 --- a/src/snapshots/nixdoc__test__doc_comment.snap +++ b/src/snapshots/nixdoc__test__doc_comment.snap @@ -20,7 +20,6 @@ This is a parsed example doc comment in markdown format - ## `lib.debug.argumentTest` {#function-library-lib.debug.argumentTest} doc comment in markdown format @@ -33,7 +32,6 @@ Type: (Should NOT be a heading) This is just markdown - structured function argument : `formal1` @@ -60,4 +58,3 @@ structured function argument Comment - diff --git a/test.nix b/test.nix deleted file mode 100644 index 3a2310e..0000000 --- a/test.nix +++ /dev/null @@ -1,37 +0,0 @@ -/** -Prequel -*/ -{lib}: -{ - - /** - Create a file set from a path that may or may not exist - */ - packagesFromDirectoryRecursive = - # Options. - { - /** - rfc style - - ``` - Path -> AttrSet -> a - ``` - */ - callPackage, - /* - legacy multiline - - ``` - Path - ``` - */ - directory, - # legacy single line - config, - # legacy - # block - # comment - moreConfig, - }: - 1; -} \ No newline at end of file