{"id":21338887,"url":"https://github.com/cybertoothca/ember-cli-marked-down","last_synced_at":"2025-03-16T02:22:31.035Z","repository":{"id":39886044,"uuid":"72169371","full_name":"cybertoothca/ember-cli-marked-down","owner":"cybertoothca","description":"This addon provides a means to generate html formatted markup from markdown source.  The ShowdownJS library is leveraged to generate the html and this addon has been designed to be configured at the application's `environment.js` level.","archived":false,"fork":false,"pushed_at":"2023-02-23T13:12:53.000Z","size":3346,"stargazers_count":1,"open_issues_count":22,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-22T16:38:48.435Z","etag":null,"topics":["ember-addon","html-markup","markdown","showdownjs"],"latest_commit_sha":null,"homepage":"","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/cybertoothca.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-28T03:16:38.000Z","updated_at":"2022-04-06T18:37:31.000Z","dependencies_parsed_at":"2023-02-17T05:46:02.335Z","dependency_job_id":null,"html_url":"https://github.com/cybertoothca/ember-cli-marked-down","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cybertoothca%2Fember-cli-marked-down","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cybertoothca%2Fember-cli-marked-down/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cybertoothca%2Fember-cli-marked-down/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cybertoothca%2Fember-cli-marked-down/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cybertoothca","download_url":"https://codeload.github.com/cybertoothca/ember-cli-marked-down/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243814979,"owners_count":20352077,"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-addon","html-markup","markdown","showdownjs"],"created_at":"2024-11-22T00:41:06.703Z","updated_at":"2025-03-16T02:22:30.617Z","avatar_url":"https://github.com/cybertoothca.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ember-cli-marked-down\n\n[![npm version](http://badge.fury.io/js/ember-cli-marked-down.svg)](http://badge.fury.io/js/ember-cli-marked-down) ![downloads](https://img.shields.io/npm/dy/ember-cli-marked-down.svg) [![Code Climate](http://codeclimate.com/github/cybertoothca/ember-cli-marked-down/badges/gpa.svg)](http://codeclimate.com/github/cybertoothca/ember-cli-marked-down)\n\n[![ember-observer-badge](http://emberobserver.com/badges/ember-cli-marked-down.svg)](http://emberobserver.com/addons/ember-cli-marked-down) [![License](http://img.shields.io/npm/l/ember-cli-marked-down.svg)](LICENSE.md)\n\nThis addon provides a means to generate html formatted markup from\n_markdown_ source. The [ShowdownJS](https://github.com/showdownjs/showdown)\nlibrary is leveraged to generate the html and this addon has been\ndesigned to be globally configured at the application's\n`environment.js` level.\n\nIt is worth mentioning that [Markdown was created by John Gruber](https://daringfireball.net/projects/markdown/)\nand the [ShowdownJS](https://github.com/showdownjs/showdown) library\nwas authored by John Fraser and is\na _vanilla_ port of Gruber's original works.\n\n## Compatibility\n\n- Ember.js v3.12 or above\n- Ember CLI v2.13 or above\n- Node.js v10 or above\n\n## Installation\n\n```\nember install ember-cli-marked-down\n```\n\n## Demo\n\n[Check out the demo application](http://ember-cli-marked-down.cybertooth.io).\n\n## Cross-Side Scripting (XSS) Vulnerability\n\nNotice: this addon will be converting _Markdown_ source in the\nclient (browser). The produced HTML\nis passed to `Ember.String.htmlSafe(...)` to attempt to filter any\nXSS attempts. This is not fool-proof. **Know your user audience and\nassume all risks.**\n\n## ShowdownJS\n\n[Check out ShowdownJS's wiki post about XSS for additional information](\u003chttps://github.com/showdownjs/showdown/wiki/Markdown's-XSS-Vulnerability-(and-how-to-mitigate-it)\u003e).\n\n# Usage\n\n## Helpers\n\n### `{{marked-down \"Some __markdown__ text\"}}`\n\nThe helper that produces html from the supplied markdown. Override [Showdown's options](https://github.com/showdownjs/showdown#valid-options) by passing named arguments to the helper.\n\n#### Arguments\n\n- The markdown source `String` is the only unnamed argument passed\n  into the helper.\n- Use the helper's hash to supply all other markdown options that need\n  be applied to the cooked html. See the options [listed above in the\n  ShowdownJS Configuration](#showdownjs-configuration) section.\n\n#### Examples\n\n```handlebars\n{{marked-down 'Some __markdown__ text'}}\n```\n\n...yields:\n\n```html\n\u003cp\u003eSome \u003cstrong\u003emarkdown\u003c/strong\u003e text\u003c/p\u003e\n```\n\nPassing in a Showdown option:\n\n```handlebars\n{{marked-down 'Some ~~struck~~ markdown text' strikethrough=true}}\n```\n\n...yields\n\n```html\n\u003cp\u003eSome \u003cdel\u003estruck\u003c/del\u003e markdown text\u003c/p\u003e\n```\n\n## Components\n\n### `{{set-links-target}}`\n\nThis component surrounds some html markup, searches the surrounded\nmarkup for `\u003ca\u003e` elements (links), and then proceeds to\nadd a specified `target` attribute to the link should it not already\nhave a target.\n\nThe component by default will not assign the `target` attribute to\nlinks that it finds that belong to the host that the application is\nrunning in. That is to say, if an app is running at\nhttp://example.com and the component find a link that starts with\n`http://example.com`, then that link will NOT have a target attribute\nassigned. This default behaviour can be overridden by setting the\n`excludeSelfLinks?` argument to `false`.\n\n#### Arguments\n\n- `excludeSelfLinks?` - when `true` (DEFAULT) any links that are found\n  in the component's yield that share the same host url as the Ember\n  application will NOT have the target attribute assigned. When `false`\n  all found links will have the target attribute assigned.\n- `targetValue` - one of the valid target values that can be passed to\n  the `target` attribute of an anchor/link element. One of: `_blank`,\n  `_self`, `_parent`, `_top`, or the name of a frame in the page. See\n  [W3Schools reference](http://www.w3schools.com/jsref/prop_anchor_target.asp).\n\n#### Examples\n\nDefault Behaviour:\n\n```handlebars\n{{#set-links-target excludeSelfLinks?=true targetValue='_blank'}}\n  \u003ca href='http://github.com'\u003eGitHub\u003c/a\u003e\n{{/set-links-target}}\n```\n\n... will result in the following html markup:\n\n```html\n\u003cdiv class=\"set-links-target\"\u003e\n  \u003ca href=\"http://github.com\" target=\"_blank\"\u003eGitHub\u003c/a\u003e\n\u003c/div\u003e\n```\n\n## Services\n\n### `ShowdownConverter`\n\nThis service sets the Showdown libraries globals from the\n`environment.js` settings; [see the sample configuration\nabove](#showdownjs-configuration).\n\n## Initializers\n\n### `ShowdownConverter`\n\nAn initializer that makes sure the `ShowdownConverter` service is\ninitialized for all scopes. This forces the `Showdown` globals to\nbe set to the settings found in the `environment.js`.\n\n### ShowdownJS Configuration (Optional)\n\nInside the Ember application's `config/environment.js`, set\nShowdownJS' global option preferences. Use the\nfollowing example as a template:\n\n```javascript\n// config/environment.js\n\nmodule.exports = function (environment) {\n  var ENV = {\n    // ...\n    APP: {\n      // ...\n      /**\n       * Showdown global configuration settings.\n       * @see https://github.com/showdownjs/showdown#valid-options\n       */\n      showdown: {\n        /**\n         * (boolean) [default false] Omit the trailing newline in a code block.\n         */\n        omitExtraWLInCodeBlocks: false,\n        /**\n         * (boolean) [default false] Disable the automatic generation of header ids. Setting to true\n         * overrides prefixHeaderId\n         */\n        noHeaderId: false,\n        /**\n         * (boolean) [default false] Generate header ids compatible with github style (spaces are\n         * replaced with dashes and a bunch of non alphanumeric chars are removed) (since showdown-1.5.5).\n         */\n        ghCompatibleHeaderId: false,\n        /**\n         * (string/boolean) [default false] Add a prefix to the generated header ids. Passing a\n         * string will prefix that string to the header id. Setting to true will add a generic 'section' prefix.\n         */\n        prefixHeaderId: false,\n        /**\n         * (boolean) [default false] Enable support for setting image dimensions from within markdown syntax.\n         */\n        parseImgDimensions: false,\n        /**\n         * (integer) [default 1] Set the header starting level.\n         */\n        headerLevelStart: 1,\n        /**\n         * (boolean) [default false] Turning this on will enable GFM autolink style.\n         */\n        simplifiedAutoLink: false,\n        /**\n         * (boolean) [default false] This option excludes trailing punctuation from\n         * autolinking urls. Punctuation excluded: . ! ? ( ). Only applies if\n         * simplifiedAutoLink option is set to true.\n         */\n        excludeTrailingPunctuationFromURLs: false,\n        /**\n         * (boolean) [default false] Turning this on will stop showdown from interpreting underscores\n         * in the middle of words as \u003cem\u003e and \u003cstrong\u003e and instead treat them as literal underscores.\n         */\n        literalMidWordUnderscores: false,\n        /**\n         * (boolean) [default false] Enable support for strikethrough syntax.\n         */\n        strikethrough: false,\n        /**\n         * (boolean) [default false] Enable support for tables syntax.\n         */\n        tables: false,\n        /**\n         * (boolean) [default false] If enabled adds an id property to table headers tags.\n         */\n        tablesHeaderId: false,\n        /**\n         * (boolean) [default true] Enable support for GFM code block style.\n         */\n        ghCodeBlocks: true,\n        /**\n         * (boolean) [default false] Enable support for GFM takslists.\n         */\n        tasklists: false,\n        /**\n         * (boolean) [default false] Prevents weird effects in live previews due to incomplete input.\n         */\n        smoothLivePreview: false,\n        /**\n         * (boolean) [default false] Tries to smartly fix indentation problems related to es6\n         * template strings in the midst of indented code.\n         */\n        smartIndentationFix: false,\n        /**\n         * (boolean) [default false] Disables the requirement of indenting sublists by\n         * 4 spaces for them to be nested, effectively reverting to the old behavior where\n         * 2 or 3 spaces were enough. (since showdown-1.5.0).\n         */\n        disableForced4SpacesIndentedSublists: false,\n        /**\n         * (boolean) [default false] Parses line breaks as like GitHub does, without\n         * needing 2 spaces at the end of the line (since showdown-1.5.1).\n         */\n        simpleLineBreaks: false,\n        /**\n         * (boolean) [default false] Makes adding a space between # and the header text\n         * mandatory (since showdown-1.5.3).\n         */\n        requireSpaceBeforeHeadingText: false,\n        /**\n         * (boolean) [default false] Enables github @mentions, which link to the username\n         * mentioned (since showdown-1.6.0).\n         */\n        ghMentions: false,\n      },\n    },\n  };\n  // ...\n  return ENV;\n};\n```\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcybertoothca%2Fember-cli-marked-down","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcybertoothca%2Fember-cli-marked-down","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcybertoothca%2Fember-cli-marked-down/lists"}