Add more file properties, organize storage, add video block

This commit is contained in:
Christoph Hagen
2025-01-06 15:31:19 +01:00
parent 96c0a75c2f
commit 6cf310d849
25 changed files with 712 additions and 219 deletions

View File

@ -0,0 +1,26 @@
import Splash
struct SwiftBlock: BlockProcessor {
static let blockId: ContentBlock = .swift
let content: Content
let results: PageGenerationResults
let language: ContentLanguage
private let swift = SyntaxHighlighter(format: HTMLOutputFormat())
init(content: Content, results: PageGenerationResults, language: ContentLanguage) {
self.content = content
self.results = results
self.language = language
}
func process(_ markdown: Substring) -> String {
// Highlight swift code using Splash
let code = markdown.between("```swift", and: "```").trimmed
return "<pre><code>" + swift.highlight(code) + "</pre></code>"
}
}