markdown 0.4.0 markdown: ^0.4.0 copied to clipboard
A library for converting markdown to HTML.
dartdoc markdown library #
This is a standalone version of the dartdoc markdown library. It parses markdown and converts it to HTML.
Installation #
Add this to your pubspec.yaml
(or create it):
dependencies:
markdown: any
Then run the Pub Package Manager (comes with the Dart SDK):
pub install
Usage #
import 'package:markdown/markdown.dart' show markdownToHtml;
main() {
print(markdownToHtml('Hello *Markdown*'));
}
Version 0.4 adds support for GitHub style triple backtick code blocks, with built in Dart syntax coloring. Custom classifiers can be added using a callback:
import 'package:markdown/markdown.dart' show markdownToHtml;
main() {
print(markdownToHtml("Hello *Markdown*"), (syntax, source) {
if (syntax == 'mysyntax') return classifySyntax(source);
return source;
});
}
String classifySyntax(String source) {
return '<span class="mysyntax">$source</span>';
}