• Stars
    star
    575
  • Rank 77,622 (Top 2 %)
  • Language
    Swift
  • License
    MIT License
  • Created over 5 years ago
  • Updated almost 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Markdown Editor that can execute Swift code

🎰 Markdown Playgrounds for Swift

Swift 5 Swift Package Manager compatible @objcio

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.

We're using this app to update our book Advanced Swift, and while writing blog posts. We find it very useful, and we hope you do too.

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.

Screen Shot 2019-04-02 at 12 51 40

Learn more

We're documenting the building of this app on Swift Talk, a weekly video series of conversational live-coding hosted by Chris Eidhof and Florian Kugler.

video cover

The first episode previews the app, and is free to watch.

Building

Note: currently this builds, but doesn't run from Xcode. Instead, build and run from the command line.

  • 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 .

Future Direction

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.

License

This library is released under the MIT license. See LICENSE for details.

More Repositories

1

app-architecture

Sample Code of the App Architecture Book
Swift
2,021
star
2

functional-swift

Issue repository for the Functional Swift book
Swift
927
star
3

issue-13-viper

Objective-C
846
star
4

core-data

Sample code for the objc.io Core Data book
Swift
769
star
5

issue-1-lighter-view-controllers

Example project for the 1st issue of objc.io
Objective-C
740
star
6

articles

All current objc.io articles
593
star
7

thinking-in-swiftui-sample-code

Sample code for the Thinking in SwiftUI book
Swift
318
star
8

swift-talk-backend

Swift
287
star
9

tiny-networking

Tiny Networking Library
Swift
257
star
10

OptimizingCollections

Home of my talk about Optimizing Collections in Swift
Swift
233
star
11

issue-21-core-image-explorer

Sample code for the Introduction to Core Image article in objc.io issue #21
Swift
216
star
12

issue-3-collection-view-layouts

Objective-C
194
star
13

issue-4-full-core-data-application

Objective-C
164
star
14

issue5-view-controller-transitions

Simple demo app showing custom view controller transitions
Objective-C
124
star
15

attributed-string-builder

Attributed String Builders
Swift
108
star
16

issue-2-background-core-data

Objective-C
89
star
17

issue-10-core-data-network-application

Sample project for objc.io article http://www.objc.io/issue-10/networked-core-data-application.html
Objective-C
88
star
18

issue-7-lab-color-space-explorer

Objective-C
74
star
19

issue-12-custom-layer-property-animations

Issue 12: Custom Layer Property Animations
Objective-C
66
star
20

issue-3-auto-layout-debugging

Objective-C
62
star
21

issue-14-xpc

Sample Project for objc.o Article about XPC
Swift
55
star
22

LedgerGUI

Swift
55
star
23

issue-12-interactive-animations-pop

Objective-C
50
star
24

S01E51-playground-driven-development-at-kickstarter

Sample code for Swift Talk episode 51: Playground-Driven Development at Kickstarter
Swift
48
star
25

S01E01-networking

Sample code for Swift Talk episode 1: Networking
Swift
46
star
26

issue-12-interactive-animations-uidynamics

Interactive Animations with UIDynamics
Objective-C
45
star
27

swift-talk-app-swiftui

Swift Talk App using SwiftUI
Swift
45
star
28

swiftui-challenges

SwiftUI challenges
41
star
29

issue-12-interactive-animations

Interactive Animations on iOS
Objective-C
41
star
30

issue-2-background-networking

Objective-C
40
star
31

issue-4-importing-and-fetching

Objective-C
39
star
32

keychain-item

Keychain Item Property Wrapper
Swift
38
star
33

StaticSite

Simple and blunt static site generator
Swift
37
star
34

issue-2-background-file-io

Objective-C
34
star
35

metal-demo-objcio

Sample code for Issue #18 of objc.io
Objective-C
33
star
36

issue-7-contact-editor

Objective-C
30
star
37

issue-8-quadcopter-navigator

Objective-C
30
star
38

S01E34-reactive-programming

Sample code for Swift Talk episode 34: Reactive Programming
Swift
25
star
39

issue-14-scriptable-apps

Objective-C
24
star
40

thinking-in-swiftui-code

Accompanying code for the book Thinking in SwiftUI
24
star
41

S01E03-loading-view-controllers

Sample code for Swift Talk episode 3
Swift
23
star
42

advanced-swift

Feedback and issue-tracker for objc.io's Advanced Swift book
23
star
43

S01E53-test-driven-reactive-programming-at-kickstarer

Sample code for Swift Talk episode 53: Test-Driven Reactive Programming at Kickstarter
Swift
21
star
44

S01E90-concurrent-map

Sample code for Swift Talk episode 90: Concurrent Map
Swift
19
star
45

S01E25-network-caching

Sample code for Swift Talk episode 25: Network Caching
Swift
18
star
46

issue-7-linguistic-tagging

Objective-C
18
star
47

S01E05-connecting-view-controllers

Sample code for Swift Talk Episode #5: Connecting View Controllers
Swift
17
star
48

S01E06-generic-table-view-controllers

Sample code for Swift Talk Episode #6: Generic Table View Controllers
Swift
16
star
49

issue-6-compiler-tool

Example code for a standalone clang/llvm tool.
C++
16
star
50

S01E26-generic-table-view-controllers-part-2

Sample code for Swift Talk episode 26: Generic Table View Controllers (Part 2)
Swift
15
star
51

collection-view-swiftui

Sample code for Swift Talk episode 168: SwiftUI — Building a Collection View (Part 2)
Swift
15
star
52

thinking-in-swiftui-qa

15
star
53

issue-16-functional-apis

Example playground for the article http://www.objc.io/issue16/functional-swift-apis.html
Swift
13
star
54

s01e47-testable-view-models-at-kickstarter

Sample code for Swift Talk episode 47: View Models at Kickstarter
Swift
12
star
55

swift-talk-shared

Swift
11
star
56

issue-12-interactive-animations-osx

Objective-C
11
star
57

S01E57-certificate-pinning

Sample code for Swift Talk episode 57: Certificate Pinning
Swift
10
star
58

S01E43-view-controller-refactoring

Swift
10
star
59

S01E02-rendering-commonmark

Sample code for Swift Talk episode 2: Rendering CommonMark
Swift
10
star
60

S01E62-testable-view-controllers-with-reducers

Sample code for Swift Talk episode 62: Testable View Controllers with Reducers
Swift
10
star
61

S01E145-setting-up-a-document-based-app

Sample code for Swift Talk episode 145: Markdown Playgrounds — Setting Up a Document Based App
Swift
10
star
62

issue-9-string-parsing

Objective-C
9
star
63

S01E75-auto-layout-with-key-paths

Sample code for Swift Talk episode 75: Auto Layout with Key Paths
Swift
9
star
64

S01E49-deeplinking-at-kickstarter

Swift
8
star
65

S01E133-tiny-networking-library-revisited

Sample code for Swift Talk episode 133: Networking: Tiny Networking Library Revisited
Swift
8
star
66

S01E174-animation-curves

Sample code for Swift Talk episode 174: SwiftUI — Animation Curves
Swift
7
star
67

S01E07-stack-views-with-enums

Sample code for Swift Talk episode #7: Stack Views with Enums
Swift
7
star
68

issue-14-plugins

Objective-C
7
star
69

S01E117-showing-hiding-sections

Sample code for Swift Talk episode 117: Building a Form Library: Showing & Hiding Sections
Swift
7
star
70

S01E08-networking-post-requests

Sample code for Swift Talk episode 8: Networking: POST Requests
Swift
7
star
71

S01E27-typed-notifications-part-1

Sample code for Swift Talk episode 27: Typed Notifications (Part 1)
Swift
6
star
72

DynamicLayout

Swift
6
star
73

S01E109-ios-remote-debugger-connecting-with-bonjour

Sample code for Swift Talk episode 109: iOS Remote Debugger: Connecting with Bonjour
Swift
6
star
74

S01E253-flow-layout-revisited

Sample code for Swift Talk 253: SwiftUI – Flow Layout Revisited
Swift
6
star
75

S01E225-swiftui-layout-explained-view-protocols-and-shapes

Sample code for Swift Talk 225: SwiftUI Layout Explained – View Protocols and Shapes
Swift
6
star
76

S01E333-sticky-headers-for-scroll-views

Sample code for Swift Talk 333: Sticky Headers for Scroll Views
Swift
6
star
77

S01E73-view-bindings-in-pure-swift

Sample code for Swift Talk episode 73: View Bindings in Pure Swift
Swift
6
star
78

S01E71-type-safe-file-paths-with-phantom-types

Sample code for Swift Talk episode 71: Type-Safe File Paths with Phantom Types
Swift
5
star
79

S01E66-the-elm-architecture-part-1

Sample code for Swift Talk episode 66: The Elm Architecture (Part 1)
Swift
5
star
80

S01E45-server-side-swift-routing

Swift
5
star
81

S01E28-typed-notifications-part-2

Sample code for Swift Talk episode 28: Typed Notifications (Part 2)
Swift
5
star
82

retro-rampage

Swift
5
star
83

S01E235-swiftui-layout-explained-layout-priorities

Sample code for Swift Talk 235: SwiftUI Layout Explained – Layout Priorities
Swift
5
star
84

S01E19-from-runtime-programming-to-functions

Sample code for Swift Talk episode 19: From Runtime Programming to Functions
Swift
5
star
85

S01E04-rendering-commonmark-part-2

Swift Talk Episode 4: Rendering CommonMark (Part 2)
Swift
5
star
86

S01E175-building-a-shopping-cart-animation

Sample code for Swift Talk episode 175: SwiftUI — Building a Shopping Cart Animation
Swift
5
star
87

libpq

Swift
4
star
88

S01E29-protocols-class-hierarchies

Sample code for Swift Talk episode 29: Protocols & Class Hierarchies
Swift
4
star
89

S01E156-a-first-look-at-swiftui

Sample code for Swift Talk episode 156: SwiftUI — A First Look
Swift
4
star
90

S01E149-swift-syntax-highlighting

Sample code for Swift Talk episode 149: Markdown Playgrounds — Swift Syntax Highlighting
Swift
4
star
91

S01E179-building-a-shopping-cart-cleanup-and-refactoring

Sample code for Swift Talk episode 179: SwiftUI — Building a Shopping Cart — Cleanup & Refactoring
Swift
4
star
92

S01E229-swiftui-layout-explained-flexible-frames

Sample code for Swift Talk 229: SwiftUI Layout Explained – Flexible Frames
Swift
4
star
93

S01E86-sharing-state-between-view-controllers-in-mvc-part-1

Sample code for Swift Talk episode 86: Sharing State Between View Controllers in MVC (Part 1)
Swift
4
star
94

S01E168-building-a-collection-view-part-2

Sample code for Swift Talk episode 168: SwiftUI — Building a Collection View (Part 2)
Swift
4
star
95

S01E406-detecting-visible-cells

Sample code for Swift Talk 406: Detecting Visible Cells
Swift
4
star
96

S01E36-futures

Sample Code for Swift Talk Episode 36: Futures
Swift
4
star
97

S01E211-quick-open-simple-fuzzy-matching

Sample code for Swift Talk 211: Quick Open — Simple Fuzzy Matching
Swift
4
star
98

S01E183-lap-times

Sample code for Swift Talk episode 183: SwiftUI Stopwatch — Lap Times
Swift
3
star
99

S01E137-testing-networking-code

Sample code for Swift Talk episode 136: Networking — Testing Networking Code
Swift
3
star
100

S01E63-mutable-shared-structs-part-2

Sample code for Swift Talk episode 63: Mutable Shared Structs (Part 2)
Swift
3
star