Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/benziahamed/playme
Convert Swift Playgrounds to Markdown
https://github.com/benziahamed/playme
command-line-tool markdown playgrounds swift-3 swift3 tool utility
Last synced: about 1 month ago
JSON representation
Convert Swift Playgrounds to Markdown
- Host: GitHub
- URL: https://github.com/benziahamed/playme
- Owner: BenziAhamed
- License: gpl-3.0
- Created: 2017-03-10T20:24:03.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-21T17:09:59.000Z (almost 8 years ago)
- Last Synced: 2023-03-31T16:59:53.444Z (almost 2 years ago)
- Topics: command-line-tool, markdown, playgrounds, swift-3, swift3, tool, utility
- Language: Swift
- Size: 55.7 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# playme
Convert Swift Playgrounds to Markdown## Example
This [readme](https://github.com/BenziAhamed/Tracery) was generated using playme.
## Installation
Clone this repo or just download the playme.swift file.
In a terminal type:
```sh
chmod +x playme.swift
./playme.swift path_to_your_playground
```Alternatively
```sh
swift playme.swift path_to_your_playground
```playme will print converted markdown to the terminal. Redirect its output to a file of your choice. E.g.
```sh
./playme.swift path_to_your_playground > README.md
```## Usage
```
usage: playme path_to_playground [--toc [--toc-top]] [--no-credits] [update [--check]]--toc generate a GitHub compatible TOC at the beginning of the document
--toc-top generate back to top links before relevant headers
--no-credits prevent appending credits text at the endupdate updates playme to the latest version
--check run update availability checks, but does not update--help prints usage
visit https://github.com/BenziAhamed/playme
```## Features
### Table of Contents generation
You can pass in `--toc` to generate a table of contents compatible with GitHub.```sh
./playme.swift path_to_your_playground --toc
```The table of contents will be generated, by default, at the beginning.
If you wish to control more precisely where the TOC should be created, add `{{GEN:TOC}}` a line in a _markdown formatted block_ somewhere in your playground. If your plaground has multiple pages, the first page would be the best location, but you can also add one at the end. playme will replace the line containing `{{GEN:TOC}}` with the TOC contents.
```swift
/*: This starts a markdown blockThe table of contents will be generated below:
{{GEN:TOC}}
That's the table of contents.
*/
```> Only one TOC block will be generated, so placing multiple `{{GEN:TOC}}`s will have no effect, only the first one will be considered.
### Updates
Running playme with `update` will fetch the latest version of the script from GitHub, compare the MD5 hashes of the local vs. downloaded versions of the script and if they found to be different, the local version will be replaced by the GitHub version.### Anti Credit Union
Disable appending a credits line at the end by passing in `--no-credits`.