How should one semantically tag a block of code in EPUB?

2 posts / 0 new
Last post

I have some technical documents that include blocks of source code or command-line steps. How should they be tagged semantically within an EPUB doc for ereaders to understand?

In looking through it is not clear what to use.

Or should I just rely on the 'code' and 'pre' tags in HTML?

The structure vocab is geared toward defining general document structures, so wouldn't be of much help for these kinds of domain-specific needs.

The code, pre, kbd and samp elements all provide basic semantics, unfortunately I don't know of any existing vocabs that provide finer-grained semantics for computer programs/output that could be used in the epub:type attribute. If you don't need a high level of precision, those elements should suffice.

Secondary menu