All Collections
Author Help
How do I annotate my code samples for my own purposes?
How do I annotate my code samples for my own purposes?

I'm writing a parser which extracts the code from my book and executes it, and I want to skip some of the code samples.

Leanpub Support avatar
Written by Leanpub Support
Updated over a week ago

First of all, if you're doing this, you may be better served using external code samples, and having some naming convention which indicates whether you should execute the code or not.

Now, if you just want to do it anyway (writing parsers is fun, after all!), you can do something like this if your book is using Markua:

{format: ruby, execute: false}


Leanpub does not understand the execute  attribute, so it just ignores it. However, you can use this attribute when parsing the document yourself...

Did this answer your question?