🖥 Generating Markdown files for Jekyll

As you can write comments in Markdown in Xcode Playgrounds, this makes very suitable to write documentation with compilable examples. Leveraging this, nef can create Markdown files that can be consumed from Jekyll to generate a microsite. The command to do this is:

 ➜ nef jekyll --project <path-to-input> --output <path-to-output> --main-page <path-to-index>



nef finds all the Xcode Playgrounds in an Xcode project. Each playground is considered as a section in the generated microsite structure. For each page in a playground, an entry in the corresponding section is created. The page is transformed from Swift to Markdown using the syntax described above. As a result, a directory structure matching the Xcode project structure is generated, together with a sidebar.yml that can be used as a menu in Jekyll.

nef adds some commands to modify the Markdown transformation process. All nef commands are included as Swift comments. They begin with // nef:begin: and end with // nef:end. The supported commands are:

 // nef:begin:header‌‌
 layout: docs
 // nef:end‌‌
 // nef:begin:hidden‌‌
 import Bow // This will be hidden in the Markdown file
 // nef:end‌‌
 struct Person {} // This will be present in the Markdown file