Skip to content

Commit 9831db9

Browse files
authored
Add support and styling for custom <callout-box> HTML tags (#4264)
1 parent f52f910 commit 9831db9

12 files changed

Lines changed: 49 additions & 9 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 9.0.7-wip
2+
* Add built-in CSS styling for the `<callout-box>` HTML tag.
3+
14
## 9.0.6
25
* Require analyzer 13.0.2 APIs.
36
* Introduce the {@example} directive for embedding external files, with support for extracting specific code blocks via #region tags.

dartdoc_options.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
dartdoc:
22
linkToSource:
33
root: '.'
4-
uriTemplate: 'https://github.com/dart-lang/dartdoc/blob/v9.0.6/%f%#L%l%'
4+
uriTemplate: 'https://github.com/dart-lang/dartdoc/blob/v9.0.7-wip/%f%#L%l%'

lib/resources/docs.dart.js.map

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/resources/styles.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/render/documentation_renderer.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ final _allowedElements = <String>{
206206
'SPAN',
207207
'TIME',
208208
'WBR',
209+
'CALLOUT-BOX',
209210
};
210211

211212
// Inspired by the set of HTML attributes allowed in GFM.

lib/src/version.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
const packageVersion = '9.0.6';
1+
const packageVersion = '9.0.7';

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: dartdoc
2-
version: 9.0.6
2+
version: 9.0.7-wip
33
description: A non-interactive HTML documentation generator for Dart source code.
44
repository: https://github.com/dart-lang/dartdoc
55

test/end2end/model_special_cases_test.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ void main() {
182182
Class classWithHtml;
183183
late final Method blockHtml;
184184
late final Method inlineHtml;
185+
late final Method customCalloutBoxHtml;
185186
late final PackageGraph packageGraph;
186187
late final Library exLibrary;
187188

@@ -198,6 +199,7 @@ void main() {
198199
classWithHtml = exLibrary.classes.named('SanitizableHtml');
199200
blockHtml = classWithHtml.instanceMethods.named('blockHtml');
200201
inlineHtml = classWithHtml.instanceMethods.named('inlineHtml');
202+
customCalloutBoxHtml = classWithHtml.instanceMethods.named('customCalloutBoxHtml');
201203
for (var modelElement in packageGraph.localPublicLibraries
202204
.expand((l) => l.allModelElements)) {
203205
// Accessing this getter triggers documentation-processing.
@@ -240,6 +242,10 @@ void main() {
240242
test('removes bad block HTML', () {
241243
expect(blockHtml.documentationAsHtml, isNot(contains('bad-idea')));
242244
});
245+
246+
test('can have callout-box HTML', () {
247+
expect(customCalloutBoxHtml.documentationAsHtml, contains('<callout-box>'));
248+
});
243249
});
244250

245251
group('HTML Injection when allowed', () {

testing/test_package_sanitize_html/lib/test_package_sanitize_html.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,9 @@ abstract class SanitizableHtml {
2929
///
3030
/// This is a <a href="javascript:alert('bad-idea');">bad</a> link.
3131
void inlineHtml();
32+
33+
/// Tests custom callout-box tags
34+
///
35+
/// <callout-box>A fine example</callout-box>
36+
void customCalloutBoxHtml();
3237
}

web/sig.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
67C19593977E0B284E58447F539D330E
1+
AE937D022C3148CCD0F12D78DF21EA08

0 commit comments

Comments
 (0)