{"id":26730315,"url":"https://github.com/tiddly-gittly/wikiast","last_synced_at":"2025-04-14T10:05:58.127Z","repository":{"id":174773154,"uuid":"606672635","full_name":"tiddly-gittly/wikiast","owner":"tiddly-gittly","description":"Wiki AST transformation for WYSIWYG editor and advanced dynamic widgets in Tiddlywiki.","archived":false,"fork":false,"pushed_at":"2024-10-16T16:38:19.000Z","size":1983,"stargazers_count":6,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-14T10:05:53.700Z","etag":null,"topics":["ast","compiler","low-code","plate","slatejs","tiddlywiki","tiddlywiki-plugin","tiddlywiki5","wysiwyg","wysiwyg-editor"],"latest_commit_sha":null,"homepage":"","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/tiddly-gittly.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,"publiccode":null,"codemeta":null}},"created_at":"2023-02-26T07:43:37.000Z","updated_at":"2025-02-01T18:59:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"ea38fc7c-064f-4714-a0af-0a7a910e7f89","html_url":"https://github.com/tiddly-gittly/wikiast","commit_stats":{"total_commits":47,"total_committers":1,"mean_commits":47.0,"dds":0.0,"last_synced_commit":"bc87e1eea1eda9b244e800079eaaad30019a1c2d"},"previous_names":["tiddly-gittly/wikiast"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiddly-gittly%2Fwikiast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiddly-gittly%2Fwikiast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiddly-gittly%2Fwikiast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiddly-gittly%2Fwikiast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tiddly-gittly","download_url":"https://codeload.github.com/tiddly-gittly/wikiast/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248860285,"owners_count":21173342,"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":["ast","compiler","low-code","plate","slatejs","tiddlywiki","tiddlywiki-plugin","tiddlywiki5","wysiwyg","wysiwyg-editor"],"created_at":"2025-03-27T23:19:17.472Z","updated_at":"2025-04-14T10:05:58.080Z","avatar_url":"https://github.com/tiddly-gittly.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Wikiast Transform\n\nThis folder contains AST transformers, in two types:\n\n- Between text and AST: `wikiast-util-to-wikitext`\n- Between ASTs: `wikiast-util-from-slate-plate-ast` `wikiast-util-to-slate-plate-ast`\n\n1. In `src/transform/serialize.ts`\n   1. when loading, get slate-plate-ast using wikitext -\u003e `wikiast-util-from-wikitext` -\u003e `wikiast-util-to-slate-plate-ast`\n   1. when saving, get wikitext using slate-plate-ast -\u003e `wikiast-util-from-slate-plate-ast` -\u003e `wikiast-util-to-wikitext`\n\n## AST\n\n### slate-plate-ast\n\nSlateJS don't have many constrains on how user construct their JSONSchema, so each slate-based-editor will have different AST. For example, [udecode/plate](https://github.com/udecode/plate) and [prezly/slate](https://github.com/prezly/slate) uses similar but different JSON structure.\n\nIn our packages, we choose to use udecode/plate, so we use `wikiast-util-from-slate-plate-ast` to convert Slate generated JSON to wikiast.\n\n### Wiki AST\n\nSimilar to SlateJS AST, each wiki system will generate different AST. In our package, we focus on tiddlywiki-generated AST.\n\n## How to develop new transformer for new syntax\n\n### pnpm i\n\n```sh\npnpm i\n```\n\n(See [https://npmmirror.com/](https://npmmirror.com/) for how to speed up in China)\n\n### Add code\n\n1. Add test in `test` folder as described in its [Readme](../../test/README.md) (Test Driven Development).\n1. In each `xxx-util-to/from-xxx` folder, add new transform functions to `xxxBuilder` folder.\n1. Import and put them in `builders` object in each `xxxBuilder/index.ts` file.\n\n### Test it\n\n`npm run test`\n\nYou can use `it.only` to run a single test.\n\nYou can `console.log` an ast object to see its struct and use [transform.tools](https://transform.tools/) to transform it into typescript and contribute back to [TW5-Typed](https://github.com/tiddly-gittly/TW5-Typed)\n\n### traverse.ts file\n\nIt contains `one` and `all` functions (may have different name, but concept are the same) similar to [syntax-tree/mdast-util-to-hast](https://github.com/syntax-tree/mdast-util-to-hast/blob/dfd724a5e62fc270e71bc2d5a2e4471be0c5ef5b/lib/traverse.js#L38-L108).\n\nSee [https://onetwo.ren/wiki/#AST转换成另一种AST](https://onetwo.ren/wiki/#AST%E8%BD%AC%E6%8D%A2%E6%88%90%E5%8F%A6%E4%B8%80%E7%A7%8DAST) (in Chinese) for explanation of this compiler design pattern.\n\n## Development\n\n### `Unable to resolve path to module 'wikiast-utils'.`\n\nRun `npm run build` can solve this, because wikiast-utils's `dist` needs to be build before import by other workspace members.\n\n### Publish\n\nWe use changeset to update version of all packages at once, follow [its guide for how to use](https://github.com/changesets/changesets/blob/main/docs/intro-to-using-changesets.md#adding-changesets)\n\n```sh\nnpx changeset\nnpx changeset version\nnpx changeset publish\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiddly-gittly%2Fwikiast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftiddly-gittly%2Fwikiast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiddly-gittly%2Fwikiast/lists"}