Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: samples/markdown/lib.dart

Issue 11364134: Merge libv1. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: Reupload due to error Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « samples/isolate_html/isolate_sample.dart ('k') | samples/markdown/markdown.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// Parses text in markdown format. Use this entrypoint if you want to parse 5 /// Parses text in markdown format. Use this entrypoint if you want to parse
6 /// markdown from your own Dart code. To parse markdown by running the script 6 /// markdown from your own Dart code. To parse markdown by running the script
7 /// directly from the command line, see markdown.dart. 7 /// directly from the command line, see markdown.dart.
8 #library('markdown'); 8 library markdown;
9 9
10 #source('ast.dart'); 10 part 'ast.dart';
11 #source('block_parser.dart'); 11 part 'block_parser.dart';
12 #source('html_renderer.dart'); 12 part 'html_renderer.dart';
13 #source('inline_parser.dart'); 13 part 'inline_parser.dart';
14 14
15 /// Converts the given string of markdown to HTML. 15 /// Converts the given string of markdown to HTML.
16 String markdownToHtml(String markdown) { 16 String markdownToHtml(String markdown) {
17 final document = new Document(); 17 final document = new Document();
18 18
19 final lines = markdown.split('\n'); 19 final lines = markdown.split('\n');
20 document.parseRefLinks(lines); 20 document.parseRefLinks(lines);
21 final blocks = document.parseLines(lines); 21 final blocks = document.parseLines(lines);
22 return renderToHtml(blocks); 22 return renderToHtml(blocks);
23 } 23 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 /// `<em>this <strong>is</strong> a</em> <code>markdown</code>`. 107 /// `<em>this <strong>is</strong> a</em> <code>markdown</code>`.
108 List<Node> parseInline(String text) => new InlineParser(text, this).parse(); 108 List<Node> parseInline(String text) => new InlineParser(text, this).parse();
109 } 109 }
110 110
111 class Link { 111 class Link {
112 final String id; 112 final String id;
113 final String url; 113 final String url;
114 final String title; 114 final String title;
115 Link(this.id, this.url, this.title); 115 Link(this.id, this.url, this.title);
116 } 116 }
OLDNEW
« no previous file with comments | « samples/isolate_html/isolate_sample.dart ('k') | samples/markdown/markdown.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698