{"id":19020244,"url":"https://github.com/trailsjs/trailpack-markdown-doc","last_synced_at":"2025-07-31T22:02:31.264Z","repository":{"id":57378895,"uuid":"63992379","full_name":"trailsjs/trailpack-markdown-doc","owner":"trailsjs","description":":package: Trailpack for Markdown Doc Bundler","archived":false,"fork":false,"pushed_at":"2017-02-08T17:44:37.000Z","size":49,"stargazers_count":2,"open_issues_count":5,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-24T13:36:31.200Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trailsjs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-23T01:04:53.000Z","updated_at":"2017-01-22T05:14:59.000Z","dependencies_parsed_at":"2022-09-02T21:21:21.661Z","dependency_job_id":null,"html_url":"https://github.com/trailsjs/trailpack-markdown-doc","commit_stats":null,"previous_names":["scott-wyatt/trailpack-markdown-doc"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trailsjs%2Ftrailpack-markdown-doc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trailsjs%2Ftrailpack-markdown-doc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trailsjs%2Ftrailpack-markdown-doc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trailsjs%2Ftrailpack-markdown-doc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trailsjs","download_url":"https://codeload.github.com/trailsjs/trailpack-markdown-doc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239892736,"owners_count":19714367,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T20:16:16.772Z","updated_at":"2025-02-21T18:21:51.791Z","avatar_url":"https://github.com/trailsjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# trailpack-markdown-doc\n\n[![NPM version][npm-image]][npm-url]\n[![Build status][ci-image]][ci-url]\n[![Dependency Status][daviddm-image]][daviddm-url]\n[![Code Climate][codeclimate-image]][codeclimate-url]\n\nTrailpack for viewing markdown documents as html with metadata.\nSet your doc directory folder and the trailpack automatically creates routes for the directory\nand renders the parsed markdown into your layout file using [meta-remarkable](https://github.com/bmathews/meta-remarkable). Perfect for a documentation website or flat file CMS.\n\n## Cool Features\n - Trailpack-markdown-doc will automatically blend with your existing routes.  For example, if you have a view controller for the route `/docs/hello/world` and you have an markdown file at `/docs/hello/world.md` then trailpack-markdown-doc will add the content and metadata to the route without altering the rest of your configuration. \n - This blending also does a \"Fuzzy Lookup\", so if you have a route that points to `/docs/hello/:world` and a markdown file at `/docs/hello/Readme.md` then it will apply the content and metadata to all routes that match that pattern.\n - Trailpack-markdown-doc also resolves the children and siblings for each route in your markdown doc file stucture.\n - Trailpack-markdown-doc also creates a js sitemap of all your markdown routes. \n\n## Install\n\nWith yeoman: \n```sh\n$ yo trails:trailpack trailpack-markdown-doc\n```\n\nWith NPM:\n```sh\n$ npm install --save trailpack-markdown-doc\n```\n\n## Configure\n\n```js\n// config/main.js\nmodule.exports = {\n  packs: [\n    // ... other trailpacks\n    require('trailpack-markdown-doc')\n  ]\n}\n```\n\n```js\n// config/markdowndoc.js\n'use strict'\n\nmodule.exports = {\n  // Directory containing docs\n  path: '/docs',\n  // Prefix to be used for routes\n  prefix: 'docs',\n  // The layout page to embed the doc\n  layout: 'index.ejs'\n}\n```\n\n### Markdown\ntrailpack-markdown-doc supports YAML style Metadata in markdown documents (.md)\n\n```\n---\nTitle:   My awesome markdown file\nAuthor:  Me\nScripts:\n    - js/doStuff.js\n    - js/doMoreStuff.js\n---\n\n## Header\nRegular text and stuff goes here.\n```\n\nThis way, a nice table is also created at the header of the page on sites like Github which makes this flatfile approach even more powerful.\n\n## Examples\n\n```html\n// views/index.ejs (or your view engine) using MarkdowndocController\n\u003c!doctype html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n  \u003ctitle\u003e\u003c% if ( meta \u0026\u0026 meta.Title ) { %\u003e\u003c%= meta.Title %\u003e\u003c% } else { %\u003eOpps, no Title\u003c% } %\u003e\u003c/title\u003e\n  \u003cmeta charset=\"UTF-8\"\u003e\n  \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1\"\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n  \u003cul\u003e\n  \u003c% for(var i=0; i \u003c sitemap.length; i++) { %\u003e\n    \u003cli\u003e\n      \u003ca href=\"\u003c%= sitemap[i].path %\u003e\"\u003e\u003c%= sitemap[i].title %\u003e\u003c/a\u003e\n      \u003c% if ( sitemap[i].children.length \u003e 0 ) { %\u003e\n      \u003cul\u003e\n        \u003c% for(var r=0; r \u003c sitemap[i].children.length; r++) { %\u003e\n        \u003cli\u003e\n          \u003ca href=\"\u003c%= sitemap[i].children[r].path %\u003e\"\u003e\u003c%= sitemap[i].children[r].title %\u003e\u003c/a\u003e\n          \u003c% if ( sitemap[i].children[r].children.length \u003e 0 ) { %\u003e\n          \u003cul\u003e\n            \u003c% for(var rr=0; rr \u003c sitemap[i].children[r].children.length; rr++) { %\u003e\n            \u003cli\u003e\n              \u003ca href=\"\u003c%= sitemap[i].children[r].children[rr].path %\u003e\"\u003e\u003c%= sitemap[i].children[r].children[rr].title %\u003e\u003c/a\u003e\n            \u003c/li\u003e\n            \u003c% } %\u003e\n          \u003c/ul\u003e\n          \u003c% } %\u003e\n        \u003c/li\u003e\n        \u003c% } %\u003e\n      \u003c/ul\u003e\n      \u003c% } %\u003e\n   \u003c/li\u003e\n  \u003c% } %\u003e\n  \u003c/ul\u003e\n\n  \u003c%- content %\u003e\n\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n[npm-image]: https://img.shields.io/npm/v/trailpack-markdown-doc.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/trailpack-markdown-doc\n[ci-image]: https://img.shields.io/travis/trailsjs/trailpack-markdown-doc/master.svg?style=flat-square\n[ci-url]: https://travis-ci.org/trailsjs/trailpack-markdown-doc\n[daviddm-image]: http://img.shields.io/david/trailsjs/trailpack-markdown-doc.svg?style=flat-square\n[daviddm-url]: https://david-dm.org/trailsjs/trailpack-markdown-doc\n[codeclimate-image]: https://img.shields.io/codeclimate/github/trailsjs/trailpack-markdown-doc.svg?style=flat-square\n[codeclimate-url]: https://codeclimate.com/github/trailsjs/trailpack-markdown-doc\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrailsjs%2Ftrailpack-markdown-doc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrailsjs%2Ftrailpack-markdown-doc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrailsjs%2Ftrailpack-markdown-doc/lists"}