Skip to content

Instantly share code, notes, and snippets.

@griffin-stewie
Created October 23, 2021 02:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save griffin-stewie/ef4d0b5a41487a38c926482573afc3ce to your computer and use it in GitHub Desktop.
Save griffin-stewie/ef4d0b5a41487a38c926482573afc3ce to your computer and use it in GitHub Desktop.
Extension which write-to support for swift-markdown.
import Foundation
import Markdown
extension Markup {
func write(to destination: URL, formatOptions: MarkupFormatter.Options = .default, atomically useAuxiliaryFile: Bool = true, encoding: String.Encoding = .utf8) throws {
let string = format(options: formatOptions)
try string.write(to: destination, atomically: useAuxiliaryFile, encoding: encoding)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment