0.0.4 • Published 5 years ago

origami-plugin-markdown-docs v0.0.4

Weekly downloads
19
License
MIT
Repository
github
Last release
5 years ago

Origami Markdown Documentation plugin

This is a simple yet powerful plugin for generating documentation from Markdown files in the fileystem on Origami. It comes out of the box with a theme, however it integrates nicely with origami-app-theme if you want to handle the rendering of the documents there.

Installation

yarn add origami-plugin-markdown-docs

Configuration

In your .origami file, add this to your plugins:

{
    ...
    "plugins": {
        "markdown-docs": true
    }
    ...
}

Options:

OptionTypeRequiredDefaultDescription
directorystringNo'docs'Directory for the markdown files to read
prefixstringNo'/docs'URL prefix for serving the documentation
themeTemplatestring, falseNofalsePass the response data to origami-app-theme to render
cssFilestringNo/docs/docs.cssThe path to the css file to include in each article
cssHREFstringNoOverride the default css file with a custom stylesheet link
sidebarSkipRootbooleanNotrueDon't include the root level folder in the sidebar
logostringNotrueURL of the logo to display at the top of the sidebar
siteTitlestringNo'DocumentationTitle of the sidebar next to the logo

Integration with origami-app-theme

In your .origami file, pass a template from your theme you want to render into themeTemplate:

{
    ...
    "plugins": {
        "markdown-docs": {
            "themeTemplate": "documentation-article"
        }
    },
    "apps": {
        "theme": "my-theme"
    }
    ...
}

Page template data

The theme template will be rendered with all the needed data on the response object.

OptionTypeDescription
bodystringThe markdown rendered into a HTML string
treeobjectA recursive tree of the entire file structure supplied in the directory option
cssstringA URL to the css sheet
headingsarrayAn array of headings for the current article (useful for building table's of contents)
urlstringThe current url (useful for matching active links, etc)
sidebarSkipRootbooleanSee sidebarSkipRoot in the options
logostringSee logo in the options
siteTitlestringSee siteTitle in the options

Caching

By default, markdown-docs caches the rendered pages resulting in a much faster load time. To disable this, simply access a url with ?nocache at the end of the url to rebuild that individual page

Contributions

This project is maintained by the Origami Core team.

Moving forward / TODO

  • [] Add tests
  • [] Customize theme colours/fonts, etc
  • [] Implement searching with lunrjs

Issues

If you find a bug, please file an issue on the issue tracker on GitHub.

Credits

Full credits for this project go to the Origami Core team