Skip to content

Instantly share code, notes, and snippets.

@takahi-i
Last active May 27, 2016 02:17
Show Gist options
  • Save takahi-i/fb1b7a2ea0e052d7985cea1e0bc82309 to your computer and use it in GitHub Desktop.
Save takahi-i/fb1b7a2ea0e052d7985cea1e0bc82309 to your computer and use it in GitHub Desktop.

Suppress RedPen errors with annotation

Writers want to suppress errors from RedPen. In such cases, writers list up the error types they want to suppress. The list of the errors are written down to the beginning of sections or paragraphs where they want to suppress the spcified errors.

The following is a sample of AsciiDoc section which suppress two error types. In the section, the specified errors are suppressed even when RedPen detect errors.

//@Suppress@ SuccessiveWord InvalidExpression
= Section 1
This is is section one yeah.

As we see, the list of the errors are written in the comment just before the seciton and annotation, @Suppress@ is added before the list of errors.

Supported format

The suppression is supported with AsciiDoc and Re:VIEW formats.

@mojavelinux
Copy link

Maybe it would be better to use regular AsciiDoc attributes (or at least as an alternative)?

[suppress="SuccessiveWord InvalidExpression"]
= Section 1
This is is section one yeah.

@takahi-i
Copy link
Author

takahi-i commented May 12, 2016

Thank you very much for the valuable comment @mojavelinux! The suggested annotation style (AsciiDoc attribute) is better than my idea.

I just have one concern on the attribute style annotation. That is, some users want to skip errors in one paragraph not the whole section. Does AsciiDoc allow users to add attributes for paragraphs?

The following is the sample.

= Section 1
This is the first paragraph.

This is the second paragraph.

[suppress="SuccessiveWord InvalidExpression"]
This is is the third paragraph yeah.

In the sample, the writer wants suppress from third paragraph not whole section (Section 1).

Any comments would be helpful.

@takahi-i
Copy link
Author

takahi-i commented May 12, 2016

It looks that AsciiDoc support attributes before paragraphs.

http://asciidoctor.org/docs/asciidoc-syntax-quick-reference/#paragraphs

We will change the annotation style for AsciiDoc following your advice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment