{"_id":"@aegisjsproject/md-editor","name":"@aegisjsproject/md-editor","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@aegisjsproject/md-editor","version":"1.0.0","description":"A custom Markdown editor component with preview as a form input element","keywords":["aegis","aegisjsproject","markdown","custom-input","secure","sanitizer-api","custom-elements","web-components","md-editor","markdown-editor","markdown-viewer","form-associated-custom-element","form-associated"],"type":"module","main":"./md-editor.cjs","module":"./md-editor.js","unpkg":"./md-editor.min.js","exports":{".":{"import":"./md-editor.js","require":"./md-editor.cjs"},"./*.js":{"import":"./*.js","require":"./*.cjs"},"./*.mjs":{"import":"./*.js","require":"./*.cjs"},"./*.cjs":{"import":"./*.js","require":"./*.cjs"},"./*":{"import":"./*.js","require":"./*.cjs"}},"engines":{"node":">=18.0.0"},"private":false,"scripts":{"test":"npm run lint:js && npm run run:tests","start":"http-server -c ./http.config.js","preversion":"npm test && npm run build","prepare":"npm test && npm run build","lint:js":"eslint .","fix:js":"eslint . --fix","build":"npm run build:js","run:tests":"node --test","clean":"rm -f ./*.cjs","build:js":"npm run clean && rollup -c rollup.config.js","create:lock":"npm i --package-lock-only --ignore-scripts --no-audit --no-fund","version:bump":"npm run version:bump:patch","version:bump:patch":"npm version --no-git-tag-version patch && npm run create:lock","version:bump:minor":"npm version --no-git-tag-version minor && npm run create:lock","version:bump:major":"npm version --no-git-tag-version major && npm run create:lock"},"repository":{"type":"git","url":"git+https://github.com/AegisJSProject/md-editor.git"},"author":{"name":"Chris Zuber","email":"admin@kernvalley.us"},"license":"MIT","funding":[{"type":"librepay","url":"https://liberapay.com/shgysk8zer0"},{"type":"github","url":"https://github.com/sponsors/shgysk8zer0"}],"bugs":{"url":"https://github.com/AegisJSProject/md-editor/issues"},"homepage":"https://github.com/AegisJSProject/md-editor#readme","devDependencies":{"@rollup/plugin-terser":"^0.4.4","@shgysk8zer0/eslint-config":"^1.0.4","@shgysk8zer0/http-server":"^1.1.1","@shgysk8zer0/importmap":"^1.4.60","@shgysk8zer0/rollup-import":"^1.2.6","eslint":"^9.25.1","rollup":"^4.40.1"},"_id":"@aegisjsproject/md-editor@1.0.0","gitHead":"d9190cec4e4353d916b574cae206f59efb3be805","_nodeVersion":"20.9.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-xOKccm+/3UpZd0UEKYRdtTYnHBdSs42+1pbLRLeczgPc/6KCiuLLFuOFM5xeT3wsQ8lv7jx9kO3Sa0RF+T6izA==","shasum":"d5c6850e9a3cc10203b1e3e2422381b190dc620e","tarball":"https://registry.npmjs.org/@aegisjsproject/md-editor/-/md-editor-1.0.0.tgz","fileCount":8,"unpackedSize":531988,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@aegisjsproject%2fmd-editor@1.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIGjzPKfFMgSckkEyE/0ob5/dpKP9hjqLBO5ZW9zbl4JRAiEAuLzB5jQE3ps3qcvIFzNRBOn1Njp9B4UHhRnLFsEmPcQ="}]},"_npmUser":{"name":"shgysk8zer0","email":"shgysk8zer0@gmail.com"},"directories":{},"maintainers":[{"name":"shgysk8zer0","email":"shgysk8zer0@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/md-editor_1.0.0_1746039712751_0.4225014275687249"},"_hasShrinkwrap":false}},"time":{"created":"2025-04-30T19:01:52.673Z","1.0.0":"2025-04-30T19:01:52.972Z","modified":"2025-04-30T19:01:53.422Z"},"maintainers":[{"name":"shgysk8zer0","email":"shgysk8zer0@gmail.com"}],"description":"A custom Markdown editor component with preview as a form input element","homepage":"https://github.com/AegisJSProject/md-editor#readme","keywords":["aegis","aegisjsproject","markdown","custom-input","secure","sanitizer-api","custom-elements","web-components","md-editor","markdown-editor","markdown-viewer","form-associated-custom-element","form-associated"],"repository":{"type":"git","url":"git+https://github.com/AegisJSProject/md-editor.git"},"author":{"name":"Chris Zuber","email":"admin@kernvalley.us"},"bugs":{"url":"https://github.com/AegisJSProject/md-editor/issues"},"license":"MIT","readme":"# `@aegisjsproject/md-editor`\n\nA custom Markdown editor component with preview as a form input element\n\n[![CodeQL](https://github.com/AegisJSProject/md-editor/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/AegisJSProject/md-editor/actions/workflows/codeql-analysis.yml)\n![Node CI](https://github.com/AegisJSProject/md-editor/workflows/Node%20CI/badge.svg)\n![Lint Code Base](https://github.com/AegisJSProject/md-editor/workflows/Lint%20Code%20Base/badge.svg)\n\n[![GitHub license](https://img.shields.io/github/license/AegisJSProject/md-editor.svg)](https://github.com/AegisJSProject/md-editor/blob/master/LICENSE)\n[![GitHub last commit](https://img.shields.io/github/last-commit/AegisJSProject/md-editor.svg)](https://github.com/AegisJSProject/md-editor/commits/master)\n[![GitHub release](https://img.shields.io/github/release/AegisJSProject/md-editor?logo=github)](https://github.com/AegisJSProject/md-editor/releases)\n[![GitHub Sponsors](https://img.shields.io/github/sponsors/shgysk8zer0?logo=github)](https://github.com/sponsors/shgysk8zer0)\n\n[![npm](https://img.shields.io/npm/v/@aegisjsproject/md-editor)](https://www.npmjs.com/package/@aegisjsproject/md-editor)\n![node-current](https://img.shields.io/node/v/@aegisjsproject/md-editor)\n![npm bundle size gzipped](https://img.shields.io/bundlephobia/minzip/@aegisjsproject/md-editor)\n[![npm](https://img.shields.io/npm/dw/@aegisjsproject/md-editor?logo=npm)](https://www.npmjs.com/package/@aegisjsproject/md-editor)\n\n[![GitHub followers](https://img.shields.io/github/followers/AegisJSProject.svg?style=social)](https://github.com/AegisJSProject)\n![GitHub forks](https://img.shields.io/github/forks/AegisJSProject/md-editor.svg?style=social)\n![GitHub stars](https://img.shields.io/github/stars/AegisJSProject/md-editor.svg?style=social)\n[![Twitter Follow](https://img.shields.io/twitter/follow/shgysk8zer0.svg?style=social)](https://twitter.com/shgysk8zer0)\n\n[![Donate using Liberapay](https://img.shields.io/liberapay/receives/shgysk8zer0.svg?logo=liberapay)](https://liberapay.com/shgysk8zer0/donate \"Donate using Liberapay\")\n- - -\n\n- [Code of Conduct](./.github/CODE_OF_CONDUCT.md)\n- [Contributing](./.github/CONTRIBUTING.md)\n<!-- - [Security Policy](./.github/SECURITY.md) -->\n## Installation\n\n### Node Instructions\n```bash\nnpm i @aegisjsproject/md-editor\n```\n\n### Using [`<script type=\"importmap\">`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/script/type/importmap) and a CDN\n\n```html\n<script type=\"importmap\">\n  {\n    \"imports\": {\n      \"@aegisjsproject/md-editor\": \"https://unpkg.com/@aegisjsproject/md-editor@1.0.0/md-editor.min.js\"\n    }\n  }\n</script>\n```\n\n### Just Using a `<script>`\n\n```html\n<script src=\"https://unpkg.com/@aegisjsproject/md-editor@1.0.0/md-editor.min.js\" crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\" defer=\"\"></script>\n```\n\n## Example Usage\n\n### Just using HTML\n\n```html\n<form id=\"post\">\n  <label for=\"content\">Content</label>\n  <!-- This behaves basically like a textarea or any input -->\n  <md-editor name=\"content\" id=\"content\" minlength=\"40\" mode=\"editor\" required=\"\">\n    # Hello, World!\n    ![foo](/img/foo.png)\n  </md-editor>\n  <!-- Rest of form stuff -->\n</form>\n```\n\n### Creating through Scripting\n\n```js\n// Need to import if not already added\nimport '@aegisjsproject/md-editor';\n\n// Get the component class\nconst HTMLMarkdownEditorElement = customElements.get('md-editor');\n\n// Create and setup the element\nconst editor = new HTMLMarkdownEditorElement();\neditor.name = 'content';\neditor.id = 'content';\n\n// Optionally bind to `history.state[whatever]\neditor.textContent = history.state?.content;\neditor.addEventListener('change', ({ target }) => history.replaceState({ content: target.value }, '', location.href), { passive: true });\n\n// Add to the form, after its `<label>`\ndocument.querySelector(`label[for=\"${editor.id}\"]`).after(editor);\n```\n\n## Usage Notes and Browser APIs\n\nThis component utilizes some proposed and experimental APIs including `Element.prototype.setHTML` (this [Sanitizer API](https://github.com/WICG/sanitizer-api))\nand [`String.dedent`](https://github.com/tc39/proposal-string-dedent). These APIs **MUST** be polyfilled. You may find\nthe required polyfills in [`@shgysk8zer0/polyfills`](https://npmjs.com/package/@shgysk8zer0/polyfills) or provide your own.\n\n## Security\n\nLike all `@aegisjsproject` libraries, this component is indended to be safe and compatible in highly secure contexts. It\nis designed to work with a very restricted [CSP](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Security-Policy)\nas well as [the Trusted Types API](https://developer.mozilla.org/en-US/docs/Web/API/Trusted_Types_API).\n\n### Example CSP\n\nNote the [SRI](https://developer.mozilla.org/en-US/docs/Web/Security/Practical_implementation_guides/SRI) Integrity used\nfor a `<script type=\"importmap\">` and the Trusted Types Policy of `aegis-sanitizer#html` (required for the Sanitizer API polyfill).\n\n```\nContent-Security-Policy: default-src 'self'; script-src 'self' https://unpkg.com/@shgysk8zer0/ https://unpkg.com/@aegisjsproject/ 'sha384-XYouuKGvd2BSrapxPZFWENl9b0loR7EVyC2cls6tQ/Oa+3R/uWw6TQ+nWa4/zt9l'; style-src 'self' https://unpkg.com/@highlightjs/ https://unpkg.com/@aegisjsproject/; img-src 'self'; trusted-types aegis-sanitizer#html; require-trusted-types-for 'script';\n```\n","readmeFilename":"README.md","_rev":"1-5e63084af75ffb69173d5f5cc7edd450"}