Skip to content

Commit af0a8eb

Browse files
committed
html escape unresolved references
1 parent dca768f commit af0a8eb

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
build/
22
doc/api/
3+
doc/sdk/
34
testing/test_package/doc
45
testing/test_package_small/doc
56
packages

lib/src/markdown_processor.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ String _linkDocReference(String reference, ModelElement element,
144144
if (_emitWarning) {
145145
print(" warning: unresolved doc reference '$reference' (in $element)");
146146
}
147-
return '<code>$reference</code>';
147+
return '<code>${HTML_ESCAPE.convert(reference)}</code>';
148148
}
149149
}
150150

@@ -195,7 +195,7 @@ class Documentation {
195195
bool specifiesLanguage = pre.classes.isNotEmpty;
196196
pre.classes.add('prettyprint');
197197
// Assume the user intended Dart if there are no other classes present.
198-
if (!specifiesLanguage) pre.classes.add('language-dart');
198+
if (!specifiesLanguage) pre.classes.add('language-dart');
199199
}
200200

201201
// `trim` fixes issue with line ending differences between mac and windows.

testing/test_package/lib/example.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ class PublicClassImplementsPrivateInterface implements _PrivateInterface {
274274
/// 3. All references should be hyperlinks. [MyError] and
275275
/// [ShapeType] and [MyError] and [MyException] and
276276
/// [MyError] and [MyException] and
277-
/// [ShapeType] foo bar.
277+
/// [List<int>] foo bar.
278278
class ShapeType extends _RetainedEnum {
279279
static const ShapeType rect = const ShapeType._internal("Rect");
280280
static const ShapeType ellipse = const ShapeType._internal("Ellipse");

testing/test_package_docs/ex/ShapeType-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
<p>All references should be hyperlinks. <a href="ex/MyError-class.html">MyError</a> and
137137
<code>ShapeType</code> and <a href="ex/MyError-class.html">MyError</a> and <code>MyException</code> and
138138
<a href="ex/MyError-class.html">MyError</a> and <code>MyException</code> and
139-
<code>ShapeType</code> foo bar.</p></li></ol>
139+
<code>List&lt;int&gt;</code> foo bar.</p></li></ol>
140140
</section>
141141

142142

0 commit comments

Comments
 (0)