{"id":20710338,"url":"https://github.com/ericwindmill/mdast_dart","last_synced_at":"2025-07-04T16:35:55.142Z","repository":{"id":213158454,"uuid":"733182522","full_name":"ericwindmill/mdast_dart","owner":"ericwindmill","description":"Dart mdast implementation","archived":false,"fork":false,"pushed_at":"2023-12-18T18:44:16.000Z","size":49,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-11T06:19:13.673Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dart","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/ericwindmill.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-12-18T18:43:13.000Z","updated_at":"2025-01-06T23:08:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"a2e9dcbc-d85e-410c-8c4b-de7bffc32dd6","html_url":"https://github.com/ericwindmill/mdast_dart","commit_stats":null,"previous_names":["ericwindmill/mdast_dart"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ericwindmill/mdast_dart","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericwindmill%2Fmdast_dart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericwindmill%2Fmdast_dart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericwindmill%2Fmdast_dart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericwindmill%2Fmdast_dart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ericwindmill","download_url":"https://codeload.github.com/ericwindmill/mdast_dart/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericwindmill%2Fmdast_dart/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263577268,"owners_count":23483132,"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-17T02:11:18.040Z","updated_at":"2025-07-04T16:35:55.094Z","avatar_url":"https://github.com/ericwindmill.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mdast Dart\n\n**M**ark**d**own **A**bstract **S**yntax **T**ree.\n\nThis package transforms markdown into an [intermediate representation][],\nAST nodes. The goal of this is to make written content easier to\nwork with in Flutter.\n\nThe AST nodes in this package are a Dart \nimplementation of [mdast][].\n\n## Why use this package\n\nCurrently, creating great user experiences in\nFlutter from Markdown source files isn't easy. Flutter, unlike HTML and CSS,\napplies styling as the widgets are built, rather than during a second pass. \nThe consequence of this is that you can't create highly customized widgets from\nmarkdown source by applying html classes and id's.\n\nThis package attempts to solve that problem by transforming markdown into an AST\nof Dart objects, making it easier to work with the data into your Flutter app.\n\n**Note:** This package is not a renderer. It will not create widgets for you. If you just\nwant to render markdown in your Flutter app, and you aren't concerned with \nmaking a highly customized experience, you should use [flutter_markdown][].\n\n## Usage\n\nUsing this package most likely requires two steps:\n\n1. In a build pre-process, you transform your markdown source into mdast nodes.\n```\n// TODO(ewindmill): update this example when CLI is complete\ndart run script filename.md\n```\n\n2. In your Flutter app, you render widgets based on the AST nodes.\n\n```dart\n// TODO(ewindmill): update this example when /example is complete\n```\n\n## Mdast\n\n**mdast** is a specification for representing markdown in a [syntax\ntree][syntax-tree]. It can represent several flavours of [markdown][], \nsuch as [CommonMark][] and [GitHub Flavored Markdown][gfm].\n\nNote that mdast was created with and for TypeScript, so this package\na 1-to-1 implementation. Namely, this package doesn't\ninclude [Content Models](https://github.com/syntax-tree/mdast#content-model).\n\n#### Implemented mdast nodes\n\n- Nodes (abstract)\n    - Node\n    - Parent\n    - Child\n- Nodes\n    - Blockquote\n    - Break\n    - Code\n    - Definition\n    - Emphasis\n    - Heading\n    - Html\n    - Image\n    - ImageReference\n    - InlineCode\n    - Link\n    - LinkReference\n    - List\n    - ListItem\n    - Paragraph\n    - Root\n    - Strong\n    - Text\n    - ThematicBreak\n- Mixins (See [mdast spec](https://github.com/syntax-tree/mdast#mixin) for information)\n    - Alternative\n    - Association\n    - Reference\n    - Resource\n\n\n## Markdown transformer\n\nIn its current implementation, the markdown-to-mdast transformer \nis built on top of the [markdown package][]. \nThis package does not parse the markdown itself. \nRather, the markdown package transforms the markdown into its own AST, which\nis a list of `Element` objects that have an html `tag`. This package \ntransforms that AST into an mdast AST. \n\nThere are several limitations to this approach, which are discussed in the \n[Missing Pieces](/#missing-pieces) section.\n\nThe following html tags are currently supported. This covers [CommonMark][], \nplus footnotes. \n\n* blockquote\n* pre\n* code\n* h1\n* h2\n* h3\n* h4\n* h5\n* h6\n* hr\n* ol\n* ul\n* li\n* p\n* a\n* em\n* strong\n* img\n* br\n* section\n* sup\n\n**Any markdown syntax that the [markdown package][] does not parse into \nan `Element` with these tags will break the markdown-to-mdast transformer.**\n\n\n## Missing Pieces\n\nThis package is very much in it's version 0.0.1. It is currently a \nproof-of-concept, meant to help determine how viable it is to turn a well-defined\nAST into a tree of Flutter widgets.\n\nThus, the following major feature are missing from this package:\n\n### Mdast_dart should implement its own markdown parser.\n\n[mdast][] is a specification that, if fully implemented, could theoretically\nbe converted back into markdown. The current version of this package\nis not suitable to transform an mdast AST back into markdown \n_in it's exact original form_. \n\nFirst, because the [markdown package][] doesn't\nprovide positional information of the individual nodes in it's AST. Therefor,\nyou cannot re-render markdown and be sure that every bit of content is in the\nsame position.\n\nIf you are concerned with parsing markdown into an AST, and back into markdown,\nyou can use the [markdown-dart pub package][].\n\nSecondly, the markdown package's AST isn't concerned with ImageReferences\nor LinkReferences. \n\nFor example, consider this markdown:\n\n```text\nThis package transforms markdown into an \n[intermediate representation](https://en.wikipedia.org/wiki/Intermediate_representation),\nAST nodes. The goal of this is to make written content easier to\nwork with in Flutter.\n```\n\nvs this markdown:\n\n```text\nThis package transforms markdown into an [intermediate representation][],\nAST nodes. The goal of this is to make written content easier to\nwork with in Flutter.\n\nThe AST nodes in this package are a Dart implementation of mdast.\n\n[intermediate representation]: https://en.wikipedia.org/wiki/Intermediate_representation\n\n```\n\nThe [markdown package][]  indiscriminately parses the links in both examples \nto the equivalent `Element`s with the same \"img\" tag.\nThe same is true of Images and Image references.  \nThis makes sense if your goal is to render HTML.\n\nTherefor, in its current implementation, this package has no way to determine\nif the link was inline or a link reference, and therefor never adds a \n`LinkReference` to the resulting AST.\n\n\n### Planned updates, hinging on usefulness of proof of concept\n\n- [ ] Fork [markdown package][] and refactor it to produce mdast nodes directly.\n- [ ] Forked version should also convert mdast nodes into HTML.\n- [ ] Add AST nodes for common markdown flavors, such as Github Flavored Markdown.\n- [ ] Add build_runner to transformer\n- [ ] Add hooks into build process, allowing users to define custom markdown syntax.\n\n[flutter_markdown]: https://github.com/flutter/packages/tree/main/packages/flutter_markdown\n[markdown package]: https://pub.dev/package/markdown\n[markdown-dart pub package]: https://github.com/DrafaKiller/Markdown-dart/tree/main \n[intermediate representation]: https://en.wikipedia.org/wiki/Intermediate_representation\n[mdast]: https://github.com/syntax-tree/mdast\n[markdown]: https://daringfireball.net/projects/markdown/\n[commonmark]: https://commonmark.org\n[gfm]: https://github.github.com/gfm/","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericwindmill%2Fmdast_dart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fericwindmill%2Fmdast_dart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericwindmill%2Fmdast_dart/lists"}