diff --git a/spring-restdocs-core/src/main/resources/org/springframework/restdocs/templates/markdown/default-path-parameters.snippet b/spring-restdocs-core/src/main/resources/org/springframework/restdocs/templates/markdown/default-path-parameters.snippet index f5f1daae..f1811879 100644 --- a/spring-restdocs-core/src/main/resources/org/springframework/restdocs/templates/markdown/default-path-parameters.snippet +++ b/spring-restdocs-core/src/main/resources/org/springframework/restdocs/templates/markdown/default-path-parameters.snippet @@ -1,4 +1,5 @@ -{{path}} +`{{path}}` + Parameter | Description --------- | ----------- {{#parameters}} diff --git a/spring-restdocs-core/src/test/java/org/springframework/restdocs/request/PathParametersSnippetTests.java b/spring-restdocs-core/src/test/java/org/springframework/restdocs/request/PathParametersSnippetTests.java index 7bee0c14..1b50d3d1 100644 --- a/spring-restdocs-core/src/test/java/org/springframework/restdocs/request/PathParametersSnippetTests.java +++ b/spring-restdocs-core/src/test/java/org/springframework/restdocs/request/PathParametersSnippetTests.java @@ -25,6 +25,7 @@ import org.springframework.restdocs.AbstractSnippetTests; import org.springframework.restdocs.generate.RestDocumentationGenerator; import org.springframework.restdocs.templates.TemplateEngine; import org.springframework.restdocs.templates.TemplateFormat; +import org.springframework.restdocs.templates.TemplateFormats; import org.springframework.restdocs.templates.TemplateResourceResolver; import org.springframework.restdocs.templates.mustache.MustacheTemplateEngine; @@ -49,7 +50,7 @@ public class PathParametersSnippetTests extends AbstractSnippetTests { @Test public void pathParameters() throws IOException { this.snippet.expectPathParameters("path-parameters").withContents( - tableWithTitleAndHeader("/{a}/{b}", "Parameter", "Description") + tableWithTitleAndHeader(getTitle(), "Parameter", "Description") .row("a", "one").row("b", "two")); new PathParametersSnippet(Arrays.asList(parameterWithName("a").description("one"), parameterWithName("b").description("two"))) @@ -61,7 +62,7 @@ public class PathParametersSnippetTests extends AbstractSnippetTests { @Test public void ignoredPathParameter() throws IOException { this.snippet.expectPathParameters("ignored-path-parameter").withContents( - tableWithTitleAndHeader("/{a}/{b}", "Parameter", "Description").row("b", + tableWithTitleAndHeader(getTitle(), "Parameter", "Description").row("b", "two")); new PathParametersSnippet(Arrays.asList(parameterWithName("a").ignored(), parameterWithName("b").description("two"))) @@ -74,7 +75,7 @@ public class PathParametersSnippetTests extends AbstractSnippetTests { public void pathParametersWithQueryString() throws IOException { this.snippet.expectPathParameters("path-parameters-with-query-string") .withContents( - tableWithTitleAndHeader("/{a}/{b}", "Parameter", "Description") + tableWithTitleAndHeader(getTitle(), "Parameter", "Description") .row("a", "one").row("b", "two")); new PathParametersSnippet(Arrays.asList(parameterWithName("a").description("one"), parameterWithName("b").description("two"))).document( @@ -132,4 +133,9 @@ public class PathParametersSnippetTests extends AbstractSnippetTests { .build()); } + private String getTitle() { + return this.templateFormat == TemplateFormats.asciidoctor() ? "/{a}/{b}" + : "`/{a}/{b}`"; + } + } diff --git a/spring-restdocs-core/src/test/java/org/springframework/restdocs/test/SnippetMatchers.java b/spring-restdocs-core/src/test/java/org/springframework/restdocs/test/SnippetMatchers.java index a7875b76..bb0c146c 100644 --- a/spring-restdocs-core/src/test/java/org/springframework/restdocs/test/SnippetMatchers.java +++ b/spring-restdocs-core/src/test/java/org/springframework/restdocs/test/SnippetMatchers.java @@ -345,6 +345,7 @@ public final class SnippetMatchers { super(TemplateFormats.asciidoctor()); if (StringUtils.hasText(title)) { this.addLine(title); + this.addLine(""); } String header = StringUtils .collectionToDelimitedString(Arrays.asList(columns), " | ");