Skip to content
/ Scmark Public

Thin, faithful, but Swift-y wrappers for cmark.

License

Notifications You must be signed in to change notification settings

dduan/Scmark

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scmark

Thin, faithful, but Swift-y wrappers for cmark.

Supported Environment

Swift 5.3
macOS
Amazon Linux 2
Ubuntu Focal
Ubuntu Bionic
CentOS 8

Installation

Swift Package Manager:

.package(url: "https://github.com/dduan/Scmark", .branch("main"))

Overview

Scmark is a wrapper around the library part of cmark. It provides:

  • Simple CommonMark-to-HTML translation.
  • Syntax-tree-based traversal and manipulation.
  • Procedural input parsing.
  • Tree-to CommonMark/XML/HTML/Groff(man page)/LaTeX translation.

Scmark strives to provide good ergonomics for Swift users, while staying as close cmark's original interface as possible. Examples where APIs were adapted for Swift are:

  • Names following Swift's API Design Guidelines.
  • Tree Node, Parser, and TreeIterator has object-oriented interfaces instead of C-style free functions for ergonomics as well as memory safety.
  • Tree is a Sequence interface (syntax sugar) for using TreeIterator.
  • Enhancement with type-safety: Whereas C uses an special enum case (e.g. CMARK_EVENT_NONE) to represent errors, Scmark replaces it with Optional. Bool in place of ints from C when it's appropriate, etc.

Scmark ships with a copy of cmark 0.29.0. It has no further dependencies.

Usage

License

cmark's license is included as Sources/Ccmark/COPYING

Scmark is released under MIT license. See LICENSE.md.

About

Thin, faithful, but Swift-y wrappers for cmark.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published