{"id":20595483,"url":"https://github.com/thefrontside/hastx","last_synced_at":"2025-04-14T23:43:17.480Z","repository":{"id":178058795,"uuid":"661309083","full_name":"thefrontside/hastx","owner":"thefrontside","description":"Create Rehype syntax trees using JSX","archived":false,"fork":false,"pushed_at":"2025-02-08T13:00:45.000Z","size":108,"stargazers_count":11,"open_issues_count":2,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-28T11:43:24.272Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/thefrontside.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog.md","contributing":null,"funding":null,"license":null,"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":"2023-07-02T12:54:24.000Z","updated_at":"2025-02-03T02:33:44.000Z","dependencies_parsed_at":"2025-02-02T16:23:23.158Z","dependency_job_id":"85513ed5-1c6c-479f-81f0-f9feb6b7280c","html_url":"https://github.com/thefrontside/hastx","commit_stats":null,"previous_names":["thefrontside/hastx"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thefrontside%2Fhastx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thefrontside%2Fhastx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thefrontside%2Fhastx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thefrontside%2Fhastx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thefrontside","download_url":"https://codeload.github.com/thefrontside/hastx/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248618276,"owners_count":21134200,"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":"2024-11-16T08:13:14.931Z","updated_at":"2025-04-14T23:43:17.467Z","avatar_url":"https://github.com/thefrontside.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## hastx\n\nCreate [hast][hast] syntax trees using JSX\n\n[Hast][hast] is an abstract syntax tree format for hypertext, and it is used by\nthe [Rehype][Rehype] ecosystem as a universal representation for HTML documents.\n\nThis module provides a way to create hast trees using JSX which are suitable as\ninputs to any Rehype pipeline.\n\nFor example, the following code uses JSX to create a section of HTML and then\npipes it through the [rehype-slug][rehype-slug] and\n[rehype-autolink-headings][rehype-autolink-headings] to automatically add\ninternal ids and links to each `h1` element\n\n```jsx\nimport rehypeSlug from \"rehype-slug\";\nimport rehypeAutoLinkHeadings from \"rehype-autolink-headings\";\n\nimport { pipe } from \"lodash/fp\";\n\nlet enhanced = pipe(rehypeSlug(), rehypeAutoLinkHeandings())(\n  \u003csection\u003e\n    \u003ch1\u003eChapter 1\u003c/h1\u003e\n    \u003cp\u003eIt was the best of times. It was the worst of times...\u003c/p\u003e\n  \u003c/section\u003e,\n);\n```\n\nThis package only supports the modern \"automatic\" JSX Transform. How to\nconfigure this is highly dependent on your compiler, but generally involve\nsetting the `jsxImportSource` attribute to \"hastx\" either via a settings file or\na compiler pragma. The following list is non-exhaustive.\n\n### Deno\n\nAdd the following to your `deno.json`:\n\n```json\n{\n  \"compilerOptions\": {\n    \"jsx\": \"react-jsx\",\n    \"jsxImportSource\": \"hastx\"\n  },\n  \"imports\": {\n    \"hastx/jsx-runtime\": \"npm:hastx@latest\"\n  }\n}\n```\n\n### TypeScript\n\nInstall the \"hastx\" package from npm, and configure your jsxImportSource\n\n```json\n{\n  \"compilerOptions\": {\n    \"jsx\": \"react-jsx\",\n    \"jsxImportSource\": \"hastx\"\n  }\n}\n```\n\n[hast]: https://github.com/syntax-tree/hast\n[Rehype]: https://github.com/rehypejs/rehype\n[rehype-slug]: https://github.com/rehypejs/rehype-slug\n[rehype-autolink-headings]: https://github.com/rehypejs/rehype-autolink-headings\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthefrontside%2Fhastx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthefrontside%2Fhastx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthefrontside%2Fhastx/lists"}