Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Ze0nC/SwiftPygmentsPublishPlugin
SwiftPygments Plug in for Publish
https://github.com/Ze0nC/SwiftPygmentsPublishPlugin
publish-plugin
Last synced: about 2 months ago
JSON representation
SwiftPygments Plug in for Publish
- Host: GitHub
- URL: https://github.com/Ze0nC/SwiftPygmentsPublishPlugin
- Owner: Ze0nC
- License: mit
- Created: 2020-01-14T05:52:25.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-02-02T16:25:03.000Z (almost 2 years ago)
- Last Synced: 2024-10-30T17:20:19.613Z (2 months ago)
- Topics: publish-plugin
- Language: Swift
- Size: 21.5 KB
- Stars: 10
- Watchers: 2
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-publish - Swift Pygments
README
# SwiftPygments Plugin for Publish
A Pygments plugin for [Publish](https://github.com/johnsundell/publish) to highlight code.
[Pygments](https://pygments.org) is a syntax highlighting tool made in Python that supports many languages.
## Requirements
- `Python`
- `Pygments`: [https://pygments.org](https://pygments.org)
- `Swift 5`
- Pygments color scheme in your .css fileSwiftPygments uses `PythonKit` to interact with Pygments.
## Installation
1. Install `Python` if you don't have it on your system.
2. Install `Pygments` if you don't have it on your system.
``` zsh
$ pip3 install pygments
```
3. Add `SwiftPygmentsPublishPlugin` to your package.```swift
let package = Package(
...
dependencies: [
.package(url: "https://github.com/Ze0nC/SwiftPygmentsPublishPlugin", .branch("master"))
],
targets: [
.target(
...
dependencies: [
...
"SwiftPygmentsPublishPlugin"
]
)
]
...
)
```## Usage
1. Add `.pygments()` to your build pipeline.
```swift
import SwiftPygmentsPublishPlugin
...
try MyWebsite().publish(using: [
.installPlugin(.pygments()),
...
.addMarkdownFiles(),
...
])
```
2. Add a pygments color scheme in your `css` file. You can find many on internet.3. Write highlighted codes!
In your markdown file, specify language after ``` to get correct highlight.
````markdown
```swift
let str = "This is Swift code."
print(str)
```
````Specify code as `python`
````markdown
```python
str = "This is also Swift code."
print(str)
```
````If no language is specified, `swift` syntax will be used as default.
````markdown
```
let str = "This is also Swift code."
print(str)
```
````## Note
This plugin will highlight all code block but not inline codes.Enjoy your highlighted sites!
## Acknowledgement
Thanks to John Sundell (@johnsundell) for creating [Publish](https://github.com/johnsundell/publish) and SplashPublishPlugin
## License
MIT License