dartdart-pubdartdoc

Does dart doc support generation of markdown instead of HTML?


I have dart doc . working and generating HTML files.

I want to generate Markdown files instead.

When googling, I found this answer https://github.com/dart-lang/dartdoc/issues/1479#issuecomment-868961953 - which led me to this PR: https://github.com/dart-lang/dartdoc/pull/2703

In the diff https://github.com/dart-lang/dartdoc/pull/2703/files - I see format and md - but I'm new to this, so I don't know how to use this info to create the command I need to use.

I was expecting something like dart doc . --format md to work, but it doesn't.

Also, when I run dart doc --help, it leads me here: https://dart.dev/go/dartdoc-options-file - and it doesn't mention the ability to generate docs in Markdown.

Maybe this isn't supported? TY


Solution

  • dart doc can't create documentation in markdown format, you have to use the package dartdoc (see https://github.com/dart-lang/dartdoc/issues/3241#issuecomment-1302150336)

    You have to run dart pub global run dartdoc --format=md (but the generated md may not be pure md, see https://github.com/dart-lang/dartdoc/issues/3237).