Skip to content

Commit 2745ced

Browse files
Trim trailing lines
1 parent 71633c9 commit 2745ced

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

smithy-docgen-core/src/main/java/software/amazon/smithy/docgen/core/writers/MarkdownWriter.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,10 @@ public DocWriter openHeading(String content, int level) {
4242
writeWithNewline(StringUtils.repeat("#", level) + " " + content);
4343
return this;
4444
}
45+
46+
@Override
47+
public String toString() {
48+
// Ensure there's exactly one trailing newline
49+
return super.toString().stripTrailing() + "\n";
50+
}
4551
}

smithy-docgen-core/src/test/java/software/amazon/smithy/docgen/core/SmithyDocPluginTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,10 @@ public void assertDocumentationFiles() {
5656
}
5757

5858
private void assertServicePageContents(MockManifest manifest) {
59-
String servicePage = manifest.expectFileString("/content/SampleService.md");
59+
var actual = manifest.expectFileString("/content/SampleService.md");
60+
var expected = readExpectedPageContent("expected-outputs/SampleService.md");
6061

61-
assertEquals(servicePage, readExpectedPageContent("expected-outputs/SampleService.md"));
62+
assertEquals(expected, actual);
6263
}
6364

6465
private String readExpectedPageContent(String filename) {

smithy-docgen-core/src/test/resources/software/amazon/smithy/docgen/core/expected-outputs/SampleService.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,3 @@
33
<p> This paragraph contains documentation about Sample Service. Sample Service is defined in the Smithy IDL.
44
For more information about Smithy IDL see
55
<a href="https://smithy.io/2.0/index.html">Smithy documentation</a>.</p>
6-
7-

0 commit comments

Comments
 (0)