Skip to content

Latest commit

 

History

History
60 lines (48 loc) · 2.12 KB

README.md

File metadata and controls

60 lines (48 loc) · 2.12 KB

ItemPosterPublishPlugin

Status Swift 5.3 Swift Package Manager Mac Publish Plugin Twitter: @alexito4

Create social images for your posts to have nice Twitter Cards. This is a plugin for Publish.

⚠️ Note that the poster generation must run on MainActor but Publish 0.9.0 doesn't support concurrency properly and it cause a deadlock. You will need a workaround (like this commit) and make your command line tool be async.

Installation

Add the package to your SPM dependencies.

.package(name: "ItemPosterPublishPlugin", url: "https://github.com/alexito4/ItemPosterPublishPlugin", from: "0.0.1"),

Usage

The plugin can then be used within any publishing pipeline like this:

import PublishReadingTime
...
try DeliciousRecipes().publish(using: [
    ...
    .addMarkdownFiles(),
    .installPlugin(
        .itemPosterPublishPlugin(
            viewForItem: { item in
                Poster(title: item.title)
            },
            size: CGSize(width: 1600, height: 840)
        )
    )
    ...
])

Note that it must be installed after the Items are created (in this case by addMarkdownFiles() ).

Author

Alejandro Martinez | http://alejandromp.com | @alexito4