Skip to content

Remove Markdown formatting from title, etc., when generating EPUB package.opf  #560

@jaycolmvar

Description

@jaycolmvar

EB allows you to use Markdown formatting in the title, subtitle, and (I presume) other fields in _data/meta.yml that define the Dublin Core metadata for the book. I use this to properly italicize the title of another book when referencing that title in the subtitle of my own book, in accordance with the recommendations of the Chicago Manual of Style. For example, you can do something like the following in _data/meta.yml

title: "To Be Or Not To Be"
subtitle: "Yet Another Book About Hamlet"

EB will then italicize "Hamlet" as desired on the title and half-title pages--definitely a nice feature. However the downside is that when generating an EPUB book EB will retain the Markdown formatting when generating the dc: section of the package.opf file:

<dc:title id="title">To Be Or Not To Be</dc:title>
<dc:title id="subtitle">Yet Another Book About Hamlet</dc:title>

Would it be possible to strip the Markdown formatting when generating the package.opf file?

I'm not sure a general solution is needed here, as I think the primary use of Markdown in this context is using * or _ to produce italics. However a possible general solution when creating package.opf might be to run each of the metadata fields through the Markdown formatting process to produce HTML, and then strip out any resulting HTML tags.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions