Validating asciidoc files with asciidoctor

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Validating asciidoc files with asciidoctor

m4rt1n
Hi, is there a way to simply validate my asciidoc files with asciidoctor to see if there are any syntax errors in those files. I don't really need any output, just potential errors to be reported in the output on the command line. I could just run a simple conversion into say HTML and then delete the resulting output but curious if there is any no-output option or attribute.

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Validating asciidoc files with asciidoctor

mojavelinux
Administrator
Yes, there is a no-output option. Just set the destination file to '/dev/null'.

 $ asciidoctor -o /dev/null sample.adoc

The warnings & errors will be printed to stderr.

/dev/null is a virtual directive that tells Asciidoctor to not output anything (you don't have to be on a Unix system).

If you are using the API, you can also just convert the file to a string and just not capture the result.

[source,ruby]
----
Asciidoctor.convert_file 'sample.adoc', safe: :safe, to_file: false
----

Cheers,

-Dan

On Mon, Sep 29, 2014 at 6:37 AM, m4rt1n [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hi, is there a way to simply validate my asciidoc files with asciidoctor to see if there are any syntax errors in those files. I don't really need any output, just potential errors to be reported in the output on the command line. I could just run a simple conversion into say HTML and then delete the resulting output but curious if there is any no-output option or attribute.

Thanks!


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Validating-asciidoc-files-with-asciidoctor-tp2300.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--