Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/john-mueller/TidyHTMLPublishStep
An HTML tidying step for the Publish static site generator
https://github.com/john-mueller/TidyHTMLPublishStep
publish-plugin
Last synced: 2 months ago
JSON representation
An HTML tidying step for the Publish static site generator
- Host: GitHub
- URL: https://github.com/john-mueller/TidyHTMLPublishStep
- Owner: john-mueller
- License: mit
- Created: 2020-02-10T21:32:53.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-05-02T20:56:10.000Z (over 1 year ago)
- Last Synced: 2024-10-29T02:02:50.430Z (3 months ago)
- Topics: publish-plugin
- Language: Swift
- Size: 10.7 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-publish - Tidy HTML
README
# Tidy HTML step for Publish
A `PublishingStep` for [Publish](https://github.com/JohnSundell/Publish) that nicely formats your website's HTML using [SwiftSoup](https://github.com/scinfu/SwiftSoup).
## Installation
To install the step, add it as a dependency within your `Package.swift` manifest:
```swift
let package = Package(
...
dependencies: [
...
.package(url: "https://github.com/john-mueller/TidyHTMLPublishStep", from: "0.1.0")
],
targets: [
.target(
...
dependencies: [
...
"TidyHTMLPublishStep"
]
)
]
...
)
```Then import `TidyHTMLPublishStep` where you'd like to use it.
## Usage
The `tidyHTML(withIndentation:)` step should be inserted into your publishing pipeline *after* your HTML is generated. The default indentation is one space, if the parameter is omitted.
```swift
import TidyHTMLPublishStep
...
try DeliciousRecipes().publish(using: [
...
.generateHTML(withTheme: .foundation),
...
.tidyHTML(indentedBy: .spaces(4))
...
])
```This package also provides an alternate convenience API to the `Website.publish(withTheme:...:additionalSteps:...)` method, replacing `additionalSteps` with `preGenerationSteps` and `postGenerationSteps`. The `tidyHTML` step should be passed to the `postGenerationSteps` parameter:
```swift
import TidyHTMLPublishStep
...
try DeliciousRecipes().publish(
withTheme: theme,
postGenerationSteps: [
.tidyHTML()
]
)