{"action":"created","issue":{"url":"https://api.github.com/repos/spring-projects/spring-restdocs/issues/232","repository_url":"https://api.github.com/repos/spring-projects/spring-restdocs","labels_url":"https://api.github.com/repos/spring-projects/spring-restdocs/issues/232/labels{/name}","comments_url":"https://api.github.com/repos/spring-projects/spring-restdocs/issues/232/comments","events_url":"https://api.github.com/repos/spring-projects/spring-restdocs/issues/232/events","html_url":"https://github.com/spring-projects/spring-restdocs/issues/232","id":154683363,"number":232,"title":"Automatically escape characters that break Asciidoctor and Markdown formatting","user":{"login":"varpa89","id":501936,"avatar_url":"https://avatars.githubusercontent.com/u/501936?v=3","gravatar_id":"","url":"https://api.github.com/users/varpa89","html_url":"https://github.com/varpa89","followers_url":"https://api.github.com/users/varpa89/followers","following_url":"https://api.github.com/users/varpa89/following{/other_user}","gists_url":"https://api.github.com/users/varpa89/gists{/gist_id}","starred_url":"https://api.github.com/users/varpa89/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/varpa89/subscriptions","organizations_url":"https://api.github.com/users/varpa89/orgs","repos_url":"https://api.github.com/users/varpa89/repos","events_url":"https://api.github.com/users/varpa89/events{/privacy}","received_events_url":"https://api.github.com/users/varpa89/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/spring-projects/spring-restdocs/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/spring-projects/spring-restdocs/milestones/9","html_url":"https://github.com/spring-projects/spring-restdocs/milestones/1.1.0.RELEASE","labels_url":"https://api.github.com/repos/spring-projects/spring-restdocs/milestones/9/labels","id":1737258,"number":9,"title":"1.1.0.RELEASE","description":"","creator":{"login":"wilkinsona","id":914682,"avatar_url":"https://avatars.githubusercontent.com/u/914682?v=3","gravatar_id":"","url":"https://api.github.com/users/wilkinsona","html_url":"https://github.com/wilkinsona","followers_url":"https://api.github.com/users/wilkinsona/followers","following_url":"https://api.github.com/users/wilkinsona/following{/other_user}","gists_url":"https://api.github.com/users/wilkinsona/gists{/gist_id}","starred_url":"https://api.github.com/users/wilkinsona/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wilkinsona/subscriptions","organizations_url":"https://api.github.com/users/wilkinsona/orgs","repos_url":"https://api.github.com/users/wilkinsona/repos","events_url":"https://api.github.com/users/wilkinsona/events{/privacy}","received_events_url":"https://api.github.com/users/wilkinsona/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":7,"state":"open","created_at":"2016-04-28T19:16:34Z","updated_at":"2016-05-14T19:26:55Z","due_on":null,"closed_at":null},"comments":4,"created_at":"2016-05-13T10:39:14Z","updated_at":"2016-05-17T14:34:40Z","closed_at":null,"body":"I have a field with validation pattern like this\r\n```\r\n@Pattern(regexp = \"^$|^[0-9]{12}$\")\r\nprivate String inn;\r\n```\r\n\r\nWhen I generate the documentation for request-fields with ConstrainedFields I have this output:\r\n\r\n```\r\n|inn\r\n|String\r\n|ИНН\r\n|Must match the regular expression '^$|^[0-9]{12}$'\r\n```\r\n\r\nAs you can see there is '|' symbol which breaks the layout from [this](https://github.com/spring-projects/spring-restdocs/blob/v1.1.0.RC1/samples/rest-notes-spring-hateoas/src/test/resources/org/springframework/restdocs/templates/request-fields.snippet)\r\n\r\next.springRestDocsVersion = '1.1.0.RC1'"},"comment":{"url":"https://api.github.com/repos/spring-projects/spring-restdocs/issues/comments/219737179","html_url":"https://github.com/spring-projects/spring-restdocs/issues/232#issuecomment-219737179","issue_url":"https://api.github.com/repos/spring-projects/spring-restdocs/issues/232","id":219737179,"user":{"login":"wilkinsona","id":914682,"avatar_url":"https://avatars.githubusercontent.com/u/914682?v=3","gravatar_id":"","url":"https://api.github.com/users/wilkinsona","html_url":"https://github.com/wilkinsona","followers_url":"https://api.github.com/users/wilkinsona/followers","following_url":"https://api.github.com/users/wilkinsona/following{/other_user}","gists_url":"https://api.github.com/users/wilkinsona/gists{/gist_id}","starred_url":"https://api.github.com/users/wilkinsona/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wilkinsona/subscriptions","organizations_url":"https://api.github.com/users/wilkinsona/orgs","repos_url":"https://api.github.com/users/wilkinsona/repos","events_url":"https://api.github.com/users/wilkinsona/events{/privacy}","received_events_url":"https://api.github.com/users/wilkinsona/received_events","type":"User","site_admin":false},"created_at":"2016-05-17T14:34:39Z","updated_at":"2016-05-17T14:34:39Z","body":"Asciidoctor's straightforward. `|` can always be replaced with `{vbar}` and it'll do the right thing.\r\n\r\nAs ever, Markdown is more complicated. `|` messes up tables, but only if it isn't within back ticks. When it's not, and only when it's not, within back ticks it can be replaced with `&#124;`. If it's replaced when it's within backticks you end up with the literal `&#124;` rather than `|`. Without getting into parsing the Markdown (which I really don't want to do), it's impossible to know for certain when a `|` needs to be replaced and when it does not.\r\n\r\nI think Markdown's limitations can be avoided by changing the message for the `@Pattern` constraint to enclose the regular expression in backticks. That'll work for Markdown without adversely affecting Asciidoctor. Arguably, it'll also make the pattern easier to read (see #230)."}}