playgroundbooks / playgroundbook

Tool for Swift Playground books
https://ashfurrow.com/blog/swift-playground-books/
MIT License
259 stars 17 forks source link

Solution for: code is only in XCode Playground accessible #24

Open muescha opened 8 years ago

muescha commented 8 years ago

instead of one big file let the author create a separate file for each page

ashfurrow commented 8 years ago

Hey there, that's a good point. This tool has two modes: render and lint. Rendering transforms playgrounds into books, and linting validates the book to make sure it's well-formatted. Rendering a book from playgrounds is meant to make things easier, but it has limitations, which you've pointed out: chapters have to be in one big file. Breaking pages into separate playgrounds would work, but then we loose a lot of the benefits of rendering from a playground.

I think if someone is writing individual pages in separate playgrounds, then rendering them wouldn't be as useful, but linting their book would be. See, rendering like this tool does has other limitations, like lack of access to XPC stuff in the books. That trade off is worth it for the convenience of writing a chapter in one playground. If we take away that convenience, the tradeoff isn't as appealing.

I hope that provides some context why the tool is built the way it is. I don't think rendering individual pages like you suggests fits with the tool, but I'm happy to provide guidance if you want to write your own tool for that.

dionlarson commented 8 years ago

@muescha I believe this is what you are looking for: https://github.com/ashfurrow/playgroundbook/pull/34