๐ŸŒ Generating content 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 <nef playground> --output <path> --main-page <main-page>

Options:

ย 

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