naturalcrit / homebrewery

Create authentic looking D&D homebrews using only markdown
https://homebrewery.naturalcrit.com
MIT License
1.06k stars 326 forks source link

Homebrewery CSS/markdown in a text editor? #511

Closed aaron-j-reeves closed 6 years ago

aaron-j-reeves commented 6 years ago

Hello, ive been using a text editor (sublime) to write my code for homebrewery for a while now, and thought it would be cool to use a markdown preview plugin to see the changes live, as if I was on the website.

Any idea if you could make something like https://packagecontrol.io/packages/MarkdownLivePreview instead show homebrewery stylesheet instead of generic markdown?

Rae2che5 commented 6 years ago

Unfortunately, Homebrewery's approach doesn't quite use straight markdown; instead, it requires a few bits of markup to be parsed specially before generating HTML. The most notable of these, I think, are page and column breaks. This means that a straight markdown plugin is unlikely to be able to render the result in a way that's faithful to the webapp. @stolksdorf, correct me if I'm wrong, but I believe with v3, which uses yet more nonstandard markdown syntax, this will become even more of a problem.

I admit I've also wished for a local version of the webapp, in particular so that I can version-control my brews with git. In #407, @brianfeister raised the possibility of packaging everything as an nwjs/electron app. Brian, did you get anywhere with that? I'd be happy to collaborate on something, but it'd probably take me too long to lay the initial groundwork.

Finally, in #348 I proposed a mechanism for advanced styling that uses only standard markdown, by essentially hijacking h6 headings for this purpose. You could imagine replacing the bits of custom syntax (like \page) which the Homebrewery uses with h6 heading (like ###### pagebreak), which, with a corresponding update to the stylesheet, might be enough to reduce everything to "standard markdown + fancy CSS" and open the way to the approach @ajrc0re suggests.

stolksdorf commented 6 years ago

@ajrc0re If you add a custom style sheet to the sublime plugin you mentioned, you can make it look like the homebrewery. The standalone CSS can be found here.

@Rae2che5 I think creating a standalone app using electron would be overkill, and still not accomplish your goals. If you wish to use your own file system and source control, you can create a simple server )in any language) that would take your Markdown, compile it, wrap it into a HTML page, add the standalone css mentioned above and serve it locally.

Currently the only non-markdown syntax in the spec is the \page notation to simply split the pages. If/when v3 is released, the modified Markdown parser I'm writing will also be released separately as open-source.