'Add cover image for AsciiDoc Epub3

I am trying to add a cover image to an ASCIIDoc file (to be able to convert it to EPUB3) using this syntax

: front-cover-image: image: cover.png[width=1050, height=1600]

In the master file as mentioned in their page over here but it doesn't seem to override the default asciidoc cover page. The image cover.png lies in an images folder that exists inside the same folder as the AsciiDoc master file. Could anyone please let me know how else to resolve this, and add my own cover image?



Solution 1:[1]

The value of the front-cover-image attribute must follow a strict syntax. Using your example, the syntax must be:

:front-cover-image: image:cover.png[Front Cover,1050,1600]

Although the value is valid inline image syntax, only a subset of that syntax is supported. In particular, you must use positional attributes only and all three must be specified (alt text, width and height).

You can see where this is parsed in the code here:

https://github.com/asciidoctor/asciidoctor-epub3/blob/master/lib/asciidoctor-epub3/packager.rb#L73

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dan Allen