Merge pull request #4 from sena-mike/patch-1 Add platforms to Package.swift
Merge pull request #4 from sena-mike/patch-1
Add platforms to Package.swift
A Pygments plugin for Publish to highlight code.
Pygments is a syntax highlighting tool made in Python that supports many languages.
Python
Pygments
Swift 5
SwiftPygments uses PythonKit to interact with Pygments.
PythonKit
$ pip3 install pygments
SwiftPygmentsPublishPlugin
let package = Package( ... dependencies: [ .package(url: "https://github.com/Ze0nC/SwiftPygmentsPublishPlugin", .branch("master")) ], targets: [ .target( ... dependencies: [ ... "SwiftPygmentsPublishPlugin" ] ) ] ... )
Add .pygments() to your build pipeline.
.pygments()
import SwiftPygmentsPublishPlugin ... try MyWebsite().publish(using: [ .installPlugin(.pygments()), ... .addMarkdownFiles(), ... ])
Add a pygments color scheme in your css file. You can find many on internet.
css
Write highlighted codes!
In your markdown file, specify language after ``` to get correct highlight.
```swift let str = "This is Swift code." print(str) ```
Specify code as python
python
```python str = "This is also Swift code." print(str) ```
If no language is specified, swift syntax will be used as default.
swift
``` let str = "This is also Swift code." print(str) ```
This plugin will highlight all code block but not inline codes.
Enjoy your highlighted sites!
Thanks to John Sundell (@johnsundell) for creating Publish and SplashPublishPlugin
MIT License
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
SwiftPygments Plugin for Publish
A Pygments plugin for Publish to highlight code.
Pygments is a syntax highlighting tool made in Python that supports many languages.
Requirements
Python
Pygments
: https://pygments.orgSwift 5
SwiftPygments uses
PythonKit
to interact with Pygments.Installation
Python
if you don’t have it on your system.Pygments
if you don’t have it on your system.SwiftPygmentsPublishPlugin
to your package.Usage
Add
.pygments()
to your build pipeline.Add a pygments color scheme in your
css
file. You can find many on internet.Write highlighted codes!
In your markdown file, specify language after ``` to get correct highlight.
Specify code as
python
If no language is specified,
swift
syntax will be used as default.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 and SplashPublishPlugin
License
MIT License