Skip to content

Commit 989ba92

Browse files
authored
Merge pull request #1207 from dart-lang/more_links
fix an issue w/ references in dartdoc not being hyperlinked
2 parents 46f07e4 + 690614c commit 989ba92

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+77
-67
lines changed

lib/src/markdown_processor.dart

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,13 +192,10 @@ class Documentation {
192192
// See https://github.com/dart-lang/markdown/commit/a7bf3dd
193193
e.classes.add('prettyprint');
194194

195-
// only "assume" the user intended dart if there are no other classes
196-
// present
197-
// TODO(kevmoo): This should be `language-dart`.
198-
// Waiting on pkg/markdown v0.10
199-
// See https://github.com/dart-lang/markdown/commit/a7bf3dd
195+
// Only "assume" the user intended dart if there are no other classes
196+
// present.
200197
if (e.classes.length == 1) {
201-
e.classes.add('lang-dart');
198+
e.classes.add('language-dart');
202199
}
203200
}
204201
var asHtml = asHtmlDocument.body.innerHtml;

lib/templates/_source_code.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{#hasSourceCode}}
22
<section class="summary source-code" id="source">
33
<h2><span>Source</span> {{{crossdartHtmlTag}}}</h2>
4-
<pre class="prettyprint lang-dart">{{{ sourceCode }}}</pre>
4+
<pre class="prettyprint language-dart">{{{ sourceCode }}}</pre>
55
</section>{{/hasSourceCode}}

pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ packages:
120120
name: markdown
121121
url: "https://pub.dartlang.org"
122122
source: hosted
123-
version: "0.8.0"
123+
version: "0.10.1"
124124
matcher:
125125
description:
126126
name: matcher

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ dependencies:
1313
collection: ^1.2.0
1414
html: ^0.12.1
1515
logging: '>=0.9.0 <0.12.0'
16-
markdown: ^0.8.0
16+
markdown: ^0.10.1
1717
mustache4dart: ^1.0.9
1818
path: ^1.3.0
1919
quiver: '>=0.18.0 <0.23.0'

test/model_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ void main() {
401401
test('no references', () {
402402
expect(
403403
Apple.documentationAsHtml,
404-
'<p>Sample class <code>String</code></p><pre class="prettyprint lang-dart"> A\n'
404+
'<p>Sample class <code>String</code></p><pre class="prettyprint language-dart"> A\n'
405405
' B\n'
406406
'</pre>');
407407
});

testing/test_package/lib/example.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,12 @@ class PublicClassImplementsPrivateInterface implements _PrivateInterface {
267267
void test() {}
268268
}
269269

270+
/// [Object] foo bar
271+
///
272+
/// 3. All references should be hyperlinks. [Object] [MyError] [ShapeType]
273+
/// [MyError] [MyException]
274+
/// [MyError] [MyException] [Object]
275+
/// [ShapeType] foo bar
270276
class ShapeType extends _RetainedEnum {
271277
static const ShapeType rect = const ShapeType._internal("Rect");
272278
static const ShapeType ellipse = const ShapeType._internal("Ellipse");

testing/test_package_docs/code_in_comments/code_in_comments-library.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ <h5><a href="index.html">test_package</a></h5>
8383
<div class="col-xs-12 col-sm-9 col-md-8 main-content">
8484

8585
<section class="desc markdown">
86-
<pre class="dart prettyprint"><code>void main() {
86+
<pre class="prettyprint language-dart"><code class="language-dart">void main() {
8787
// in Dart!
8888
}
8989
</code></pre>
90-
<pre class="yaml prettyprint"><code>and_yaml:
90+
<pre class="prettyprint language-dart"><code class="language-yaml">and_yaml:
9191
- value
9292
- "value"
9393
- 3.14

testing/test_package_docs/ex/Apple-class.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ <h5><a href="ex/ex-library.html">ex</a></h5>
136136
<div class="col-xs-12 col-sm-9 col-md-8 main-content">
137137

138138
<section class="desc markdown">
139-
<p>Sample class <code>String</code></p><pre class="prettyprint lang-dart"> A
139+
<p>Sample class <code>String</code></p><pre class="prettyprint language-dart"> A
140140
B
141141
</pre>
142142
</section>

testing/test_package_docs/ex/Apple/m1.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ <h5><a href="ex/Apple-class.html">Apple</a></h5>
115115
</section>
116116
<section class="desc markdown">
117117
<p>This is a method.</p>
118-
<pre class="prettyprint lang-dart"><code>new Apple().m1();
118+
<pre class="prettyprint language-dart"><code>new Apple().m1();
119119
</code></pre>
120120
</section>
121121

testing/test_package_docs/ex/B-class.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ <h5><a href="ex/ex-library.html">ex</a></h5>
134134
<div class="col-xs-12 col-sm-9 col-md-8 main-content">
135135

136136
<section class="desc markdown">
137-
<p>Extends class <a href="ex/Apple-class.html">Apple</a>, use <a href="ex/Apple/Apple.html">new Apple</a> or <a href="ex/Apple/Apple.fromString.html">new Apple.fromString</a></p><pre class="prettyprint lang-dart"> B extends A
137+
<p>Extends class <a href="ex/Apple-class.html">Apple</a>, use <a href="ex/Apple/Apple.html">new Apple</a> or <a href="ex/Apple/Apple.fromString.html">new Apple.fromString</a></p><pre class="prettyprint language-dart"> B extends A
138138
B implements C
139139
</pre>
140140
</section>

0 commit comments

Comments
 (0)