{"id":13804633,"url":"https://github.com/willviles/ember-cli-markdown-resolver","last_synced_at":"2025-10-30T04:31:21.547Z","repository":{"id":57223373,"uuid":"103315489","full_name":"willviles/ember-cli-markdown-resolver","owner":"willviles","description":"Ember CLI addon for resolving markdown files and trees of md files.","archived":false,"fork":false,"pushed_at":"2018-07-21T10:26:48.000Z","size":531,"stargazers_count":26,"open_issues_count":2,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-03T13:06:13.238Z","etag":null,"topics":["ember","ember-addon","ember-cli","ember-cli-addon","frontmatter","markdown","resolver"],"latest_commit_sha":null,"homepage":"https://willviles.github.io/ember-cli-markdown-resolver","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/willviles.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-12T20:06:30.000Z","updated_at":"2024-05-30T02:45:16.000Z","dependencies_parsed_at":"2022-08-24T16:20:58.787Z","dependency_job_id":null,"html_url":"https://github.com/willviles/ember-cli-markdown-resolver","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willviles%2Fember-cli-markdown-resolver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willviles%2Fember-cli-markdown-resolver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willviles%2Fember-cli-markdown-resolver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willviles%2Fember-cli-markdown-resolver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/willviles","download_url":"https://codeload.github.com/willviles/ember-cli-markdown-resolver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219868432,"owners_count":16555761,"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":["ember","ember-addon","ember-cli","ember-cli-addon","frontmatter","markdown","resolver"],"created_at":"2024-08-04T01:00:51.575Z","updated_at":"2025-10-30T04:31:21.137Z","avatar_url":"https://github.com/willviles.png","language":"JavaScript","readme":"\u003cimg src=\"https://user-images.githubusercontent.com/2046935/30438539-5e23da9e-9969-11e7-8fc1-1d67a7a23aa4.png\" width=\"auto\" height=\"50\"\u003e\n\nEmber CLI Markdown Resolver\n======\n[![Build Status](https://travis-ci.org/willviles/ember-cli-markdown-resolver.svg)](https://travis-ci.org/willviles/ember-cli-markdown-resolver) [![Ember Observer Score](http://emberobserver.com/badges/ember-cli-markdown-resolver.svg)](http://emberobserver.com/addons/ember-cli-markdown-resolver) [![Download count all time](https://img.shields.io/npm/dt/ember-cli-markdown-resolver.svg)]((https://www.npmjs.com/package/ember-cli-markdown-resolver)) [![npm](https://img.shields.io/npm/v/ember-cli-markdown-resolver.svg)](https://www.npmjs.com/package/ember-cli-markdown-resolver)\n\nEmber CLI Markdown Resolver is the quickest way to include static markdown content in your Ember.js application using [Broccoli Markdown Resolver](https://github.com/willviles/broccoli-markdown-resolver).\n\n## Installation\n\n```\nember install ember-cli-markdown-resolver\n```\n\n## Configuration\n\nThe addon requires you specify the locations of markdown files:\n\n```js\n// config/environment.js\n\nENV['ember-cli-markdown-resolver'] = {\n  folders: {\n    'guides': 'app/guides'\n  }\n};\n```\n\nAnd to populate your folder with markdown content:\n\n```shell\n.\n└── app/\n    └── guides/\n        ├── quick-start.md\n        ├── examples.md\n        └── examples/\n            └── first.md\n```\n\n## Usage\n\nEmber CLI Markdown Resolver enables markdown content to be retrieved via the `markdownResolver` service.\n\n### `this.get('markdownResolver').file(type, path)`\n\nThe `file` method returns promisified markdown content, allowing the content to be chainable via `.then()`.\n\n```js\n// routes/guides/single.js\n\nimport Route from '@ember/routing/route';\nimport { get } from '@ember/object';\nimport { inject } from '@ember/service';\n\nexport default Route.extend({\n  markdownResolver: inject(),\n\n  model({ path }) {\n    return get(this, 'markdownResolver').file('guides', path);\n  }\n});\n```\n\nEach markdown file exposes the path, raw content, frontmatter attributes and its children.\n\n```hbs\n\u003c!-- templates/guides/single.hbs --\u003e\n\n{{model.content}} \u003c!-- 'Lorem ipsum dolor sit amet' --\u003e\n{{model.path}} \u003c!-- 'app/guides/examples' --\u003e\n{{model.attributes}} \u003c!-- { title: 'Examples', order: 1 } --\u003e\n{{model.children}} \u003c!-- Array of child content --\u003e\n```\n\n### `this.get('markdownResolver').tree(type)`\n\nThe `tree` method returns a tree object for a given folder, allowing menu interfaces to be built from the markdown file structure.\n\n```js\n// routes/guides.js\n\nimport Route from '@ember/routing/route';\nimport { get } from '@ember/object';\nimport { inject } from '@ember/service';\n\nexport default Route.extend({\n  markdownResolver: inject(),\n\n  model() {\n    return get(this, 'markdownResolver').tree('guides');\n  }\n});\n```\n\nAdding an `order` value to a file's frontmatter will automatically order files within the tree.\n\n```md\n---\ntitle: Quick Start\norder: 0\n---\n\nLorem ipsum dolor sit amet...\n```\n\nAdditionally, adding a `fragmentIdLinks` object to a file's frontmatter will generate a list local fragment identifier links which are used within the `{{markdown-menu-item}}` component. This is handy when you want to link to several individual sections of a large parent markdown file instead of having individual child markdown files.\n\nThe `fragmentIdLinks` object expects child key-value pairs where each `key` represents the hash fragment id link and each `value` represents the text label to be shown as a child on the `{{markdown-menu}}` component.\n\n```md\n---\ntitle: Fragment Identifier Links\norder: 4\nfragmentIdLinks:\n  iamsectionone: \"Section One\"\n  section-two: \"Section Two\"\n---\n\n### I am section one\nLorem ipsum dolor sit amet...\n\n\u003ca id=\"section-two\"\u003eLorem ipsum dolor sit amet...\n```\n\nBy default, when you click on each `fragmentIdLinks` child link within the `{{markdown-menu-item}}` component it will update the url hash. You can easily override this default behavior by passing an `onClick` closure action into the `{{markdown-menu}}` component.\n\n```hbs\n{{!-- templates/guides.hbs --}}\n{{markdown-menu onClick=(action \"clickedMenuItemLink\")}}\n```\n\n```js\n// controllers/guides.js\nimport Controller from '@ember/controller';\n\nexport default Controller.extend({\n  actions: {\n    clickedMenuItemLink(fragmentIdLink) {\n      document.querySelector(`#${fragmentIdLink}`).scrollIntoView({\n        behavior: 'smooth'\n      });\n    }\n  }\n});\n```\n\nThe addon ships with a `markdown-menu` component which builds a nested list from your file tree and can be styled using your own css.\n\n```hbs\n\u003c!-- templates/guides.hbs --\u003e\n\n{{markdown-menu\n    title=\"My Markdown Menu\"\n    tree=model}}\n{{outlet}}\n```\n\n## Helpers\n\nEmber CLI Markdown Resolver defines the following template helpers:\n\n```hbs\n\u003c!-- Gets the title property of the markdown file --\u003e\n{{get (get-markdown-file 'guides' 'nested/page-slug') 'title'}}\n\n\u003c!-- Shorthand to get content from markdown file --\u003e\n{{my-render-component content=(get-markdown-content 'guides' 'nested/page-slug')}}\n\n\u003c!-- Get the markdown tree --\u003e\n{{markdown-menu tree=(get-markdown-tree 'guides')}}\n```\n\n## Demo\n\nCheck out the [Ember CLI Markdown Resolver guides](https://willviles.github.io/ember-cli-markdown-resolver), which is generated using the addon.\n\nCode for the guides can be found [here](https://github.com/willviles/ember-cli-markdown-resolver/tree/master/tests/dummy).\n\n## Node Version\n\nEmber CLI Markdown Resolver currently supports Node \u003e=6.\n\n## Contributing\n\n### Installation\n\n* `git clone https://github.com/willviles/ember-cli-markdown-resolver.git`\n* `cd ember-cli-markdown-resolver`\n* `yarn install`\n\n### Running\n\n* `ember serve`\n* Visit your app at [http://localhost:4200](http://localhost:4200).\n\n### Running Tests\n\n* `yarn test` (Runs `ember try:each` to test your addon against multiple Ember versions)\n* `ember test`\n* `ember test --server`\n\n### Building\n\n* `ember build`\n\nFor more information on using ember-cli, visit [https://ember-cli.com/](https://ember-cli.com/).\n","funding_links":[],"categories":["Packages"],"sub_categories":["Adapters"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillviles%2Fember-cli-markdown-resolver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwillviles%2Fember-cli-markdown-resolver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillviles%2Fember-cli-markdown-resolver/lists"}