Convert Swift Playgrounds to Markdown
This readme was generated using playme.
Clone this repo or just download the playme.swift file.
In a terminal type:
chmod +x playme.swift
./playme.swift path_to_your_playground
Alternatively
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.
./playme.swift path_to_your_playground > README.md
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 end
update updates playme to the latest version
--check run update availability checks, but does not update
--help prints usage
visit https://github.com/BenziAhamed/playme
You can pass in --toc
to generate a table of contents compatible with GitHub.
./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.
/*: This starts a markdown block
The 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.
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.
Disable appending a credits line at the end by passing in --no-credits
.