{"id":24746575,"url":"https://github.com/samuelmarks/ng-md-components","last_synced_at":"2026-04-17T19:01:51.965Z","repository":{"id":33803039,"uuid":"152862575","full_name":"SamuelMarks/ng-md-components","owner":"SamuelMarks","description":"Markdown `templateUrl` support for Angular","archived":false,"fork":false,"pushed_at":"2023-01-07T05:03:45.000Z","size":251,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-02T05:54:15.090Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SamuelMarks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-13T10:51:03.000Z","updated_at":"2021-05-16T13:08:57.000Z","dependencies_parsed_at":"2023-01-15T02:39:08.445Z","dependency_job_id":null,"html_url":"https://github.com/SamuelMarks/ng-md-components","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SamuelMarks%2Fng-md-components","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SamuelMarks%2Fng-md-components/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SamuelMarks%2Fng-md-components/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SamuelMarks%2Fng-md-components/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SamuelMarks","download_url":"https://codeload.github.com/SamuelMarks/ng-md-components/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245042144,"owners_count":20551525,"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":"2025-01-28T04:29:28.343Z","updated_at":"2026-04-17T19:01:51.910Z","avatar_url":"https://github.com/SamuelMarks.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"ng-md-components\n================\n\nMarkdown `templateUrl` support for Angular\n\n[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)\n[![Version](https://img.shields.io/npm/v/ng-md-components.svg)](https://npmjs.org/package/ng-md-components)\n[![Downloads/week](https://img.shields.io/npm/dw/ng-md-components.svg)](https://npmjs.org/package/ng-md-components)\n[![npm-publish](https://github.com/SamuelMarks/ng-md-components/workflows/npm-publish/badge.svg)](https://github.com/SamuelMarks/ng-md-components/actions)\n[![License](https://img.shields.io/npm/l/ng-md-components.svg)](https://github.com/SamuelMarks/ng-md-components/blob/master/package.json)\n\n\u003c!-- toc --\u003e\n## Usage\n\n    $ ng-md-components --help\n\n    OPTIONS\n      -d, --directory=directory  (required) Directory to recurse through\n      -e, --ext=ext              [default: .md] File extension to look for\n      -h, --help                 show CLI help\n      -v, --version              show CLI version\n\n## Commands\n\u003c!-- commands --\u003e\n\n\n## Example\n\n### Setup\nLet's create an Angular application, using Markdown rather than HTML:\n\n    ng new --skip-install --interactive=false a \u0026\u0026 cd $_\n    for c in {a..z}; do ng g m \"$c\"; ng g c \"$c\" \u0026 done\n    fd .html -exec bash -c 'f=${0%.*}; pandoc \"$0\" -o \"$f.md\"; rm \"$0\"' {} \\;\n    fd .component.ts -exec sed -i 's/component.html/component.md/g' {} \\;\n\n### Reversal, using [`fd`](https://github.com/sharkdp/fd), [`bash`](https://www.gnu.org/software/bash) and [`pandoc`](https://pandoc.org)\n\n    fd .md --exclude README.md -exec bash -c 'f=${0%.*}; pandoc \"$0\" -o \"$f.html\"; rm \"$0\"' {} \\;\n    fd .component.ts -exec sed -i 's/component.md/component.html/g' {} \\;\n\nDisadvantages: the `fd` and `bash` aren't really cross-platform, and `pandoc` doesn't do code-highlighting. Also there are no helpful hints saying what's generated, and no explicit way of referencing markdown `templateUrl`.\n\n## Reversal, using `ng-md-components`\n\nOpen a file, let's use `src/app/a/a.component.ts`:\n\n```TypeScript\nimport { Component, OnInit } from '@angular/core';\n\n// templateUrl: './a.component.md' \u003c-- add this line\n\n@Component({\n  selector: 'app-a',\n  templateUrl: './a.component.html', // \u003c-- this gets generated\n  styleUrls: ['./a.component.css']\n})\nexport class AComponent {}\n```\n\nAs you can see, we have added one line, a comment. Note that our simple parsing means the first `templateUrl` will be converted into HTML.\n\n## Alternative approaches\n\nExtend `@Component` or create new decorator.\n\n### Advantages\n- Can be used without any new precompilation stage\n\n### Disadvantage\n- Bundle size\n- Dynamic rather than static, so runtime performance is impacted\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamuelmarks%2Fng-md-components","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamuelmarks%2Fng-md-components","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamuelmarks%2Fng-md-components/lists"}