{"id":13808709,"url":"https://github.com/instance-oom/ngx-markdown-editor","last_synced_at":"2025-04-12T23:29:50.465Z","repository":{"id":22462413,"uuid":"96308608","full_name":"instance-oom/ngx-markdown-editor","owner":"instance-oom","description":"Angular markdown editor based on ace editor ","archived":false,"fork":false,"pushed_at":"2024-11-21T17:12:35.000Z","size":2425,"stargazers_count":176,"open_issues_count":7,"forks_count":48,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-04T02:09:34.527Z","etag":null,"topics":["ace-editor","angular-x","markdown-editor"],"latest_commit_sha":null,"homepage":"http://lon-yang.github.io/markdown-editor/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/instance-oom.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-05T10:42:56.000Z","updated_at":"2025-03-04T16:05:22.000Z","dependencies_parsed_at":"2024-08-04T01:09:33.463Z","dependency_job_id":"4e8b58ce-571a-47e7-97fc-b001e1b5e3db","html_url":"https://github.com/instance-oom/ngx-markdown-editor","commit_stats":{"total_commits":108,"total_committers":17,"mean_commits":6.352941176470588,"dds":"0.39814814814814814","last_synced_commit":"97fffcba4e24c4f1776f351fbee7cbf59885b43d"},"previous_names":["lon-yang/ngx-markdown-editor"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/instance-oom%2Fngx-markdown-editor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/instance-oom%2Fngx-markdown-editor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/instance-oom%2Fngx-markdown-editor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/instance-oom%2Fngx-markdown-editor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/instance-oom","download_url":"https://codeload.github.com/instance-oom/ngx-markdown-editor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248647059,"owners_count":21139080,"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":["ace-editor","angular-x","markdown-editor"],"created_at":"2024-08-04T01:01:49.912Z","updated_at":"2025-04-12T23:29:50.437Z","avatar_url":"https://github.com/instance-oom.png","language":"TypeScript","readme":"# ngx-markdown-editor\nAngular markdown editor based on ace editor\n\n[![npm version](https://img.shields.io/npm/v/ngx-markdown-editor?color=rgb%2868%2C%20204%2C%2017%29)](https://badge.fury.io/js/ngx-markdown-editor)\n[![npm](https://img.shields.io/npm/dm/ngx-markdown-editor?color=rgb%2868%2C%20204%2C%2017%29)](https://www.npmjs.com/package/ngx-markdown-editor)\n[![GitHub license](https://img.shields.io/github/license/lon-yang/ngx-markdown-editor?color=rgb%2868%2C%20204%2C%2017%29)](https://github.com/lon-yang/ngx-markdown-editor/blob/master/LICENSE)\n[![GitHub stars](https://img.shields.io/github/stars/lon-yang/ngx-markdown-editor?color=rgb%252868%252C%2520204%252C%252017%2529)](https://github.com/lon-yang/ngx-markdown-editor/stargazers)\n![GitHub issues](https://img.shields.io/github/issues-raw/lon-yang/ngx-markdown-editor?color=rgb%2868%2C%20204%2C%2017%29)\n[![codesandbox.io](https://img.shields.io/badge/codesandbox.io-view-blue)](https://codesandbox.io/s/ngx-markdown-editor-zewm1u)\n\n[Online Demo](https://zewm1u.csb.app/)\n\n# Usage\n\n### Installation\n\nInstall dependencies from npm repository:\n  \n```bash\nnpm i ace-builds bootstrap font-awesome\n```\n\nInstall `ngx-markdown-editor` from npm repository:\n\n```bash\nnpm i ngx-markdown-editor\n```\n\nAdd the assets、styles and scripts in `angular.json`:\n```json\n{\n  ...\n  \"architect\": {\n    \"build\": {\n      \"options\": {\n        ...\n        \"assets\": [\n          {\n            \"glob\": \"**/*\",\n            \"input\": \"node_modules/ace-builds/src-min\",\n            \"output\": \"./assets/ace-builds/\"\n          }\n        ],\n        \"styles\": [\n          \"node_modules/bootstrap/dist/css/bootstrap.min.css\",\n          \"node_modules/font-awesome/css/font-awesome.min.css\",\n          \"node_modules/ngx-markdown-editor/assets/highlight.js/agate.min.css\"\n        ],\n        \"scripts\": [\n          \"node_modules/ngx-markdown-editor/assets/highlight.js/highlight.min.js\",\n          \"node_modules/ngx-markdown-editor/assets/marked.min.js\"\n        ]\n        ...\n      }\n    }\n  }\n  ...    \n}\n```\n\nAdd `ace.js` in `index.html`\n```html\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003cscript src=\"/assets/ace-builds/ace.js\"\u003e\u003c/script\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\u003c/body\u003e\n\u003c/html\u003e\n```\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003c=2.5.0\u003c/summary\u003e\n\u003cp\u003e\u003c/p\u003e\nInstall dependencies from npm repository:\n\n```bash\nnpm i brace bootstrap font-awesome\n```\n\nInstall `ngx-markdown-editor` from npm repository:\n```bash\nnpm i ngx-markdown-editor\n```\n\nAdd the styles and scripts in `angular.json`:\n```json\n{\n  ...\n  \"architect\": {\n    \"build\": {\n      \"options\": {\n        ...\n        \"styles\": [\n          \"node_modules/bootstrap/dist/css/bootstrap.min.css\",\n          \"node_modules/font-awesome/css/font-awesome.min.css\",\n          \"node_modules/ngx-markdown-editor/assets/highlight.js/agate.min.css\"\n        ],\n        \"scripts\": [\n          \"node_modules/ngx-markdown-editor/assets/highlight.js/highlight.min.js\",\n          \"node_modules/ngx-markdown-editor/assets/marked.min.js\"\n        ]\n        ...\n      }\n    }\n  }\n  ...    \n}\n```\n\nImport `brace` in `polyfills.ts`\n\n```ts\nimport 'brace';\nimport 'brace/mode/markdown';\n```\n\u003c/details\u003e\n\n### Sample\n\n```ts\nimport { LMarkdownEditorModule } from 'ngx-markdown-editor';\n\n@NgModule({\n  declarations: [\n    AppComponent\n  ],\n  imports: [\n    BrowserModule,\n    FormsModule, // make sure FormsModule is imported to make ngModel work\n    LMarkdownEditorModule\n  ],\n  providers: [],\n  bootstrap: [AppComponent]\n})\nexport class AppModule { }\n```\n```html\n\u003cmd-editor name=\"Content\" \n  [upload]=\"doUpload\" \n  [preRender]=\"preRenderFunc\" \n  [postRender]=\"postRenderFunc\"\n  [(ngModel)]=\"content\" \n  [height]=\"'200px'\" \n  [mode]=\"mode\" \n  [options]=\"options\" \n  (onEditorLoaded)=\"onEditorLoaded($event)\"\n  (onPreviewDomChanged)=\"onPreviewDomChanged($event)\"\n  required \n  maxlength=\"500\"\u003e\n  \u003cslot custom-btns\u003e\u003c/slot\u003e\n\u003c/md-editor\u003e\n```\n\n# Options\n- ngModel: markdown original content\n- height: editor height\n- hideToolbar: hide toolbar, default is false\n- mode: `editor` | `preview`, default is `editor`\n- options: other settings for editor\n  ```ts\n  {  \n    showPreviewPanel?: boolean    // Show preview panel, Default is true\n    showBorder?: boolean          // Show editor component's border. Default is true\n    hideIcons?: Array\u003cstring\u003e     // ['Bold', 'Italic', 'Heading', 'Reference', 'Link', 'Image', 'Ul', 'Ol', 'Code', 'TogglePreview', 'FullScreen']. Default is empty\n    usingFontAwesome5?: boolean   // Using font awesome with version 5, Default is false\n    fontAwesomeVersion?: '4' | '5' | '6'   // FontAwesome Version, 4/5/6, default is 4\n    scrollPastEnd?: number        // The option for ace editor. Default is 0\n    enablePreviewContentClick?: boolean  // Allow user fire the click event on the preview panel, like href etc. Default is false\n    resizable?: boolean           // Allow resize the editor\n    markedjsOpt?: MarkedjsOption  // The markedjs option, see https://marked.js.org/#/USING_ADVANCED.md#options\n    customRender?: {              // Custom markedjs render\n      image?: Function     // Image Render\n      table?: Function     // Table Render\n      code?: Function      // Code Render\n      listitem?: Function  // Listitem Render\n    },\n    customIcons?: {               // Custom icons in toolbar, default using font-awesome 4.x\n      Bold?: CustomIcon;\n      Italic?: CustomIcon;\n      Heading?: CustomIcon;\n      Reference?: CustomIcon;\n      Link?: CustomIcon;\n      Image?: CustomIcon;\n      UnorderedList?: CustomIcon;\n      OrderedList?: CustomIcon;\n      CodeBlock?: CustomIcon;\n      ShowPreview?: CustomIcon;\n      HidePreview?: CustomIcon;\n      FullScreen?: CustomIcon;\n      CheckBox_UnChecked?: CustomIcon;\n      CheckBox_Checked?: CustomIcon;\n    };\n    placeholder?: string\n  }\n  ```\n- upload(`Function`): For [#24](https://github.com/lon-yang/ngx-markdown-editor/issues/24), upload file by yourself\n  ```ts\n  constructor() {\n    this.doUpload = this.doUpload.bind(this);  // This is very important.\n  }\n  \n  doUpload(files: Array\u003cFile\u003e): Promise\u003cArray\u003cUploadResult\u003e\u003e {\n    // do upload file by yourself\n    return Promise.resolve([{ name: 'xxx', url: 'xxx.png', isImg: true }]);\n  }\n  \n  interface UploadResult {\n    isImg: boolean\n    name: string\n    url: string\n  }\n  ```  \n- preRender(`Function`): For [#13](https://github.com/lon-yang/ngx-markdown-editor/issues/13), this will not effect `ngModel`'s value, just rendered value\n  ```ts\n  preRenderFunc(content: string) {\n    return content.replace(/something/g, 'new value'); // must return a string\n  }\n  ```\n- postRender(`Function`): Change the html souce code generated by `marked` before update the dom\n  ```ts\n  postRenderFunc(content: string) {\n    return content.replace(/something/g, 'new value'); // must return a string\n  }\n  ```  \n- required: for form validate\n- maxlength: for form validate\n\n\u003e Tips: For `Function` input, please call bind at `constructor` to assign correct `this` pointer\n\n# Event\n- `onEditorLoaded: EventEmitter\u003cAceEditor\u003e` Fires when the ace editor loaded.\n- `onPreviewDomChanged: EventEmitter\u003cHTMLElement\u003e` Fires when the preview dom updated\n","funding_links":[],"categories":["Table of contents"],"sub_categories":["Third Party Components"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finstance-oom%2Fngx-markdown-editor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finstance-oom%2Fngx-markdown-editor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finstance-oom%2Fngx-markdown-editor/lists"}