{"id":13698132,"url":"https://github.com/rcasto/adaptive-html","last_synced_at":"2025-05-14T12:31:05.677Z","repository":{"id":30402685,"uuid":"123545974","full_name":"rcasto/adaptive-html","owner":"rcasto","description":"HTML to Adaptive Card JSON converter library","archived":false,"fork":false,"pushed_at":"2023-03-12T21:14:20.000Z","size":945,"stargazers_count":12,"open_issues_count":11,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-13T02:34:59.636Z","etag":null,"topics":["adaptive-cards","adaptivecards","authoring-tool","converter","html","wysiwyg"],"latest_commit_sha":null,"homepage":"https://rcasto.github.io/adaptive-editor/","language":"TypeScript","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/rcasto.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2018-03-02T07:30:22.000Z","updated_at":"2024-06-27T17:42:11.000Z","dependencies_parsed_at":"2024-04-08T02:51:09.648Z","dependency_job_id":"1761ebfd-c708-4ac4-bfa9-344deebd36ea","html_url":"https://github.com/rcasto/adaptive-html","commit_stats":{"total_commits":385,"total_committers":4,"mean_commits":96.25,"dds":"0.33506493506493507","last_synced_commit":"b57b15e48bcd8f96479bdd9c37f609d6876f66aa"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rcasto%2Fadaptive-html","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rcasto%2Fadaptive-html/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rcasto%2Fadaptive-html/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rcasto%2Fadaptive-html/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rcasto","download_url":"https://codeload.github.com/rcasto/adaptive-html/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225294120,"owners_count":17451479,"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":["adaptive-cards","adaptivecards","authoring-tool","converter","html","wysiwyg"],"created_at":"2024-08-02T19:00:40.401Z","updated_at":"2024-11-19T04:26:37.094Z","avatar_url":"https://github.com/rcasto.png","language":"TypeScript","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# AdaptiveHtml\nHTML to Adaptive Card JSON converter library ([Demo editor](https://rcasto.github.io/adaptive-editor/))\n\nThe goal of this project is to allow integration with existing WYSIWYG editors such as [CKEditor](https://ckeditor.com/) and convert their HTML output to an [Adaptive Card](https://adaptivecards.io/).\n\nUnder the hood, this project has taken the [Turndown](https://github.com/domchristie/turndown/) code and repurposed it.\n\n## Table of contents\n- [Getting started](#getting-started)\n- [API](#api)\n- [Currently supported HTML tags](#currently-supported-html-tags)\n- [Known caveats](#known-caveats)\n- [Building it yourself](#building-it-yourself)\n\n## Getting started\nYou can either install the npm package or use a CDN.\n\n### Via npm\n`npm install adaptive-html`\n\n### Via CDN\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/adaptive-html/dist/adaptive-html.iife.min.js\"\u003e\u003c/script\u003e\n```\n\n## API\ntoJSON(string | [HTMLElement](https://devdocs.io/dom/htmlelement)) =\u003e Adaptive Card JSON\n```javascript\nvar adaptiveCardJson = AdaptiveHtml.toJSON(`\n    \u003cp\u003eTurn me into an Adaptive Card\u003c/p\u003e\n`);\nconsole.log(JSON.stringify(adaptiveCardJson, null, '\\t'));\n/*\n    JSON returned\n\n    {\n        \"type\": \"AdaptiveCard\",\n        \"body\": [\n            {\n                \"type\": \"TextBlock\",\n                \"text\": \"Turn me into an Adaptive Card\",\n                \"wrap\": true\n            }\n        ],\n        \"actions\": [],\n        \"version\": \"1.0\"\n    }\n*/\n```\n### Override version of Adaptive Card schema used\nThe `toJSON` method has an optional options object that can be passed in as the second parameter. The only accepted property within this object at the moment is `version`, which should be the [version of the Adaptive Card schema](https://github.com/microsoft/AdaptiveCards/tree/main/schemas#referenceable-versions) that you would like associated with the generated Adaptive Card JSON output. By default, the version will be \"1.0\".\n\n```javascript\nvar adaptiveCardJson = AdaptiveHtml.toJSON(`\n    \u003cp\u003eTurn me into an Adaptive Card\u003c/p\u003e\n`, {\n    version: '1.5',\n});\nconsole.log(JSON.stringify(adaptiveCardJson, null, '\\t'));\n/*\n    JSON returned\n\n    {\n        \"type\": \"AdaptiveCard\",\n        \"body\": [\n            {\n                \"type\": \"TextBlock\",\n                \"text\": \"Turn me into an Adaptive Card\",\n                \"wrap\": true\n            }\n        ],\n        \"actions\": [],\n        \"version\": \"1.5\"\n    }\n*/\n```\n\n## Currently supported HTML tags\n- p\n- br\n- h1, h2, h3, h4, h5, h6\n- ul, ol\n- li\n- a\n- em, i\n- strong, b\n- img\n\nThe default replacement for tags not listed above depends on whether the tag refers to a [block](https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements#Elements) or [inline](https://developer.mozilla.org/en-US/docs/Web/HTML/Inline_elements#Elements) level HTML element.\n\nFor block level elements, its contents are processed, and wrapped in a [Container](https://adaptivecards.io/explorer/Container.html).  \nFor inline level elements, its contents are processed and simply returned.\n\n## Known caveats\n- Images in list steps and nested steps are pushed to the bottom of the corresponding list step\n- Lists cannot contain headings\n\n## Building it yourself\nIf you wish to build the library yourself then you can follow these steps:  \n1. Clone or download the [repository](https://github.com/rcasto/adaptive-html)\n2. `cd` to the repository directory via the command line/terminal\n3. Run `npm install` to install the necessary dependencies \n    - Note: Make sure you have [Node.js](https://nodejs.org/en/) installed\n4. Hack away\n5. Execute the command `npm run build`\n6. You should now be able to view the built libraries under the `dist/` folder within your copy of the repository\n\n### Test Client\nTo demonstrate the transformation there is a test client within the repository. To launch it follow these steps:\n1. Execute the command `npm run client` from project root\n2. Navigate to http://localhost:8080\n\n### Running tests\nYou can run tests by executing the command `npm test`.\n\nIf you want to generate a code coverage report execute the command `npm run test:report`.  Launch `coverage/index.html` in the browser to view the report.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frcasto%2Fadaptive-html","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frcasto%2Fadaptive-html","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frcasto%2Fadaptive-html/lists"}