Digital device

The global trade and standards association for electronic publishing.

IDPf's mission is to foster global adoption of an open, accessible, interoperable digital publishing ecosystem that enables innovation. IDPF's strategy to effectively advance its mssion is to develop (collaboratively) and promote EPUB as the universal accessible interchange and delivery ecosystem for eBooks and other digital publications advancing the Open Web platformRead more ›

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