read-only
Custom reference resolver may be required when parsing document without implicit defined references, for example Dartdoc.
/**
* Throws a [StateError] if ...
* similar to [anotherMethod], but ...
*/
In that case you could supply parser with resolver, which should provide all missing links.
String library = "mdown";
String version = "0.4.0";
Target linkResolver(String normalizedReference, String reference) {
if (reference.startsWith("new ")) {
String className = reference.substring(4);
return new Target("http://www.dartdocs.org/documentation/$library/$version/index.html#$library/$library.$className@id_$className-", null);
} else {
return null;
}
}
CommonMarkParser parser = new CommonMarkParser(const Options(linkResolver: linkResolver));
Document doc = parser.parse('Hello world!\n===');
String res = HtmlWriter.defaults.write(doc);