You can add custom HTML attributes to your final HTML, if you’ll be using the HTML in your own processes later – these attributes will also be included in your EPUB file. For example, you can customize the ID for a section, or you can add special role attributes to certain paragraphs so that your EPUB conforms to your company’s internal specification.
In your processing instruction paragraph, type the text ATTRS=.
Next, type the attribute name, followed by a colon, and then the attribute value.
To add more custom attributes, type a semi-colon, and then type the next attribute name, followed by a colon, and then the attribute value, and so on.
To add a custom attribute to a wrapper, insert the processing instruction paragraph after either the wrapper “start” or “end” paragraphs. (See “Customize the design of specific paragraphs, wrappers, or sections” for an example of what this looks like.)
To add a custom attribute to an entire section, insert the processing instruction paragraph after the section start paragraph. (See “Customize the design of specific paragraphs, wrappers, or sections” for an example of what this looks like.)
Using the SCOPE-BODY Option
You can also apply attributes to your entire document, by using the SCOPE-BODY option in your ATTRS processing instruction. This will apply the selected attribute to the main container element of your manuscript, rather than being applied to the immediately preceding element. To do this:
Type your ATTRS processing instruction, as described above.
After the custom attribute value, but before the closing semi-colon, type: SCOPE-BODY.
Your attribute will now be applied to the body element.
Note that the SCOPE-BODY option must be invoked for each attribute that you want to apply to the body. For example, in the image below, because only the “data-author-name” attribute invokes the SCOPE-BODY option, only that attribute will be applied to the entire body, and the “id” attribute will be applied to the immediately preceding element (in this case, the chapter title) as usual.