{"id":13561579,"url":"https://github.com/lint-md/ast-plugin","last_synced_at":"2025-04-10T04:45:47.001Z","repository":{"id":53575633,"uuid":"234824897","full_name":"lint-md/ast-plugin","owner":"lint-md","description":"The simplest abstract syntax tree walker, similar with @Babel plugin.","archived":false,"fork":false,"pushed_at":"2021-03-23T13:35:00.000Z","size":12,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-01T19:39:27.303Z","etag":null,"topics":["ast","babel","babel-plugin","plugin"],"latest_commit_sha":null,"homepage":"https://github.com/lint-md/ast-plugin","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/lint-md.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":"2020-01-19T01:58:28.000Z","updated_at":"2023-10-18T16:13:56.000Z","dependencies_parsed_at":"2022-08-28T22:01:52.694Z","dependency_job_id":null,"html_url":"https://github.com/lint-md/ast-plugin","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/lint-md%2Fast-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lint-md%2Fast-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lint-md%2Fast-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lint-md%2Fast-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lint-md","download_url":"https://codeload.github.com/lint-md/ast-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248161237,"owners_count":21057552,"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","babel","babel-plugin","plugin"],"created_at":"2024-08-01T13:00:58.721Z","updated_at":"2025-04-10T04:45:46.978Z","avatar_url":"https://github.com/lint-md.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# @lint-md/ast-plugin\n\n\u003e The simplest abstract syntax tree walker.\n\n[![Build Status](https://github.com/lint-md/ast-plugin/actions/workflows/build.yml/badge.svg)](https://github.com/lint-md/ast-plugin/actions/workflows/build.yml)\n\n## Install\n\n\u003e npm i --save ast-plugin\n\n## Usage\n\n- Traverse Ast plugins\n\n```js\nimport { Ast, Plugin } from 'ast-plugin';\n\nnew Ast(ast).traverse([\n  new TestPlugin(cfg),\n  // ...\n]);\n```\n\n- Write an ast plugin\n\n```js\nimport { Ast, Plugin } from 'ast-plugin';\n\nclass TestPlugin extends Plugin {\n\n  pre = () =\u003e {\n  };\n\n  visitor = () =\u003e {\n    return {\n      // process node with type = 'text'\n      text: ast =\u003e {\n        console.log(ast.node);\n        ast.segment();\n      },\n    };\n  };\n\n  post = () =\u003e {\n  };\n}\n```\n\n## Used by\n\n- [lint-md](https://github.com/lint-md/lint-md) Cli tool to lint your markdown file for Chinese.\n\n## License\n\nMIT@[hustcc](https://github.com/hustcc).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flint-md%2Fast-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flint-md%2Fast-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flint-md%2Fast-plugin/lists"}