Skip to content

Add ability to reference the subtitle in "styles.scss" #93

@jolekss

Description

@jolekss

Thank you very much for reviving this wonderful project! There is a small feature I have always wanted to see in this plugin.

Currently, it is possible to use "author", "copyright", and "title" in styles.scss, for example, like this:

@page {
    @top-left {
        content: string(title);
    }
}

However, it is not possible to use "subtitle", which I would really like.
I think adding this feature is a one line change. My experiments show this can be easily done by modifying the style_for_print function in styles/__init__.py as follows:

def style_for_print(options: Options) -> str:
    scss = f"""
    :root {{
        string-set: author '{_css_escape(options.author)}',
            copyright '{_css_escape(options.copyright)}',
            title '{_css_escape(options.cover_title)}',
            subtitle '{_css_escape(options.cover_subtitle)}';
    }}
    h1, h2, h3 {{
        string-set: chapter content();
    }}
    """

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions