Skip to content

jmanek/slate_node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Slate with node.js

A port of the documentation generator Slate to node.js, that can optionally be built in the browser. See it in action!

The major difference is the use of marked for parsing the .md, highlight for syntax highlighting, and Handlebars for templating.

Building

Node.js

This outputs to the build directory. Replace source/slate.md with your own markdown to use that instead

git clone https://github.com/jmanek/slate_node.git
npm install 
npm run build
# Docs are now viewable at build/index.html

Browser

Alternatively, you can directly serve the source directory from a webhost and the documentation will be built at runtime.

git clone https://github.com/jmanek/slate_node.git
npm install serve # included in npm install
./node_modules/.bin/serve source
# Docs are now viewable at localhost:5000

Any changes to source/slate.md will be incorporated into source/index.html when it is reloaded. There is now no need to have node.js installed on the machine. This way you don't have to worry about incorpoting Slate into your current build process or creating an entirely new toolchain for it (python3 -m http.server). It is a "static" version of Slate. This is inherently slower than the node.js pre-built version, but it is completely independent of operating system or platform. You will not be able to view the documentation until deploying it to a server.

Code Highlighting

Numerous themes for highlight.js are available in source/stylesheets/highlight. You can switch between them by changing this line in source/index.html

<link href="stylesheets/highlight/solarized-dark.css" rel="stylesheet" type="text/css" />

Includes

Includes are handled as described in the Slate Wiki. The filename must have an underscore prepended to it, which is not included in the markdown file description.

Todo/Bugs

  • Package it in a more modular way (Grunt?)
  • marked seems to be handling tables a bit differently, if there's too many em-dashes it's failing
  • highlight.js might have some differences in language detection than Rouge; at the very least 'shell' becomes 'bash'. Ideally this repo should be compatible with any markdown made for Ruby Slate.
  • Cleanup how marked parses the top-level settings. Right now they are manually being parsed.
  • Actually build the scss/js