🎰 Markdown Playgrounds for Swift
What it does
This app reads and writes Markdown documents that contain Swift code. The code can be executed too! You can run individual code blocks, or all the blocks in a file.
How it works
The app works by sending Swift code to a REPL instance, then reading back the results. Compared to Swift Playgrounds or Xcode's playgrounds, this is quite limiting, but it also means we can keep things simple.
The first episode previews the app, and is free to watch.
- 145: Setting Up a Document Based App —
- 146: Markdown Syntax Highlighting —
- 147: Executing Swift Code —
- 148: String Handling —
- You need to have cmark installed from master (not via homebrew). If you use the version from homebrew, you won't get proper syntax highlighting (specifically: for inline elements).
- This project uses Swift Package Manager. You can either run "swift build" or do "swift package generate-xcodeproj"
Here are the steps as shell commands:
git clone https://github.com/commonmark/cmark cd cmark mkdir build cd build cmake .. make make test make install cd ../.. # Building this project git clone https://github.com/objcio/markdown-playgrounds cd markdown-playgrounds swift build # If you want to edit this in Xcode swift package generate-xcodeproj xed .
This project could head in a number of directions, and there are many useful features we could add. Our main goal is to keep using this for authoring Swift-heavy Markdown, which will guide our decisions when we decide on new features.
To keep things simple, we have collected a list of todos in todo.txt.
This library is released under the MIT license. See LICENSE for details.