Skip to content

Commit a990c06

Browse files
committed
Merge branch 'main' into misc/sass-nesting-final
2 parents 3581723 + aaea637 commit a990c06

File tree

10 files changed

+35
-38
lines changed

10 files changed

+35
-38
lines changed

.github/workflows/scorecards-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ jobs:
4141

4242
# Upload the results as artifacts (optional).
4343
- name: "Upload artifact"
44-
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1
44+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
4545
with:
4646
name: SARIF file
4747
path: results.sarif
4848
retention-days: 5
4949

5050
# Upload the results to GitHub's code scanning dashboard.
5151
- name: "Upload to code-scanning"
52-
uses: github/codeql-action/upload-sarif@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d
52+
uses: github/codeql-action/upload-sarif@1b549b9259bda1cb5ddde3b41741a82a2d15a841
5353
with:
5454
sarif_file: results.sarif

.github/workflows/test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
run: echo "name=today::$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
4747
shell: bash
4848
- name: Cache clean flutter
49-
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf
49+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684
5050
if: matrix.job == 'flutter'
5151
env:
5252
# Increment version to invalidate bad/obsolete caches.
@@ -55,7 +55,7 @@ jobs:
5555
path: ~/.dartdoc_grinder
5656
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ steps.date.outputs.today }}
5757
- name: Cache .pub-cache
58-
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf
58+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684
5959
if: matrix.job == 'flutter'
6060
env:
6161
# Increment version to invalidate bad/obsolete caches.

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 8.3.4-wip
2+
* The URL for category pages now uses _category name_ instead of
3+
_category `displayName`_.
4+
15
## 8.3.3
26

37
* Require Dart 3.6 or later.

README.md

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -109,21 +109,21 @@ its children that have the `@nodoc` tag in the documentation comment.
109109

110110
### dartdoc_options.yaml
111111

112-
Creating a file named dartdoc_options.yaml at the top of your package can change how Dartdoc
112+
Creating a file named `dartdoc_options.yaml` at the top of your package can change how Dartdoc
113113
generates docs.
114114

115115
An example (not necessarily recommended settings):
116116

117117
```yaml
118118
dartdoc:
119119
categories:
120-
"First Category":
120+
awesome:
121121
markdown: doc/First.md
122-
name: Awesome
123-
"Second Category":
122+
displayName: Awesome
123+
great:
124124
markdown: doc/Second.md
125-
name: Great
126-
categoryOrder: ["First Category", "Second Category"]
125+
displayName: Great
126+
categoryOrder: [awesome, great]
127127
includeExternal: ['bin/unusually_located_library.dart']
128128
nodoc: ['lib/sekret/*.dart']
129129
linkTo:
@@ -137,17 +137,20 @@ dartdoc:
137137
- tool-error
138138
```
139139
140-
#### dartdoc_options.yaml fields
140+
#### `dartdoc_options.yaml` fields
141141

142142
In general, **paths are relative** to the directory of the `dartdoc_options.yaml` file in which the option
143143
is defined, and should be specified as POSIX paths. Dartdoc will convert POSIX paths automatically on Windows.
144144
Unrecognized options will be ignored. Supported options:
145145

146-
* **categories**: More details for each category/topic. For topics you'd like to document, specify
147-
the markdown file with `markdown:` to use for the category page. Optionally, rename the
148-
category from the source code into a display name with `name:`. If there is no matching category
149-
defined in dartdoc_options.yaml, those declared categories in the source code will be invisible.
150-
* **categoryOrder**: Specify the order of topics for display in the sidebar and
146+
* **categories**: A map from _category names_ to _category definitions_.
147+
The _category definition_ consists of a `markdown:` property and an optional `displayName:` property.
148+
For topics you'd like to document, specify a _markdown file_ to be rendered on the category page,
149+
using the `markdown:` property.
150+
Optionally, you may specify a `displayName:` to be used in the rendered HTML, instead of the _category name_.
151+
Categories are referenced in documentation comments using the `{@category <category name>}` tag.
152+
Categories with no matching _category name_ defined in `dartdoc_options.yaml` will be invisible.
153+
* **categoryOrder**: A list of _category names_ specifying the order of topics for display in the sidebar and
151154
the package page.
152155
* **exclude**: Specify a list of library names to avoid generating docs for,
153156
overriding any specified in include. All libraries listed must be local to this package, unlike
@@ -210,12 +213,12 @@ You can tag libraries or top level classes, functions, and variables in their do
210213
the string `{@category YourCategory}`. For libraries, that will cause the library to appear in a
211214
category when showing the sidebar on the Package and Library pages. For other types of objects,
212215
the `{@category}` will be shown with a link to the category page **but only if specified in
213-
dartdoc_options.yaml**, as above.
216+
`dartdoc_options.yaml`**, as above.
214217

215218
```dart
216219
/// Here is my library.
217220
///
218-
/// {@category Amazing}
221+
/// {@category awesome}
219222
library my_library;
220223
```
221224

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/v8.3.3/%f%#L%l%'
4+
uriTemplate: 'https://github.com/dart-lang/dartdoc/blob/v8.3.4-wip/%f%#L%l%'

lib/src/model/category.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
65
import 'package:analyzer/dart/element/element2.dart';
76
import 'package:analyzer/file_system/file_system.dart';
87
import 'package:dartdoc/src/dartdoc_options.dart';
@@ -78,7 +77,6 @@ class Category
7877
}
7978
}
8079

81-
8280
@override
8381
Element2? get element => null;
8482

@@ -107,7 +105,10 @@ class Category
107105
late final bool isDocumented =
108106
documentedWhere != DocumentLocation.missing && documentationFile != null;
109107

110-
String get filePath => 'topics/$name-topic.html';
108+
String get filePath {
109+
assert(_name != null);
110+
return 'topics/$_name-topic.html';
111+
}
111112

112113
@override
113114
String? get href => isCanonical ? '${package.baseHref}$filePath' : null;

lib/src/model/package_builder.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import 'dart:async';
66

77
import 'package:analyzer/dart/analysis/analysis_context.dart';
8-
import 'package:analyzer/dart/analysis/context_root.dart';
98
import 'package:analyzer/dart/analysis/results.dart';
109
import 'package:analyzer/dart/ast/ast.dart';
1110
import 'package:analyzer/dart/element/element2.dart';
@@ -64,9 +63,8 @@ class PubPackageBuilder implements PackageBuilder {
6463
// of handling it ourselves?
6564
resourceProvider: packageMetaProvider.resourceProvider,
6665
sdkPath: config.sdkDir,
67-
updateAnalysisOptions2: ({
66+
updateAnalysisOptions3: ({
6867
required AnalysisOptionsImpl analysisOptions,
69-
required ContextRoot contextRoot,
7068
required DartSdk sdk,
7169
}) =>
7270
analysisOptions

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: 8.3.3
2+
version: 8.3.4-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_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -720,13 +720,13 @@ void main() async {
720720
expect(
721721
category.categoryLabel,
722722
'<span class="category superb cp-0 linked" title="This is part of the Superb topic.">'
723-
'<a href="${htmlBasePlaceholder}topics/Superb-topic.html">Superb</a></span>');
723+
'<a href="${htmlBasePlaceholder}topics/Excellent-topic.html">Superb</a></span>');
724724
});
725725

726726
test('CategoryRendererHtml renders linkedName', () {
727727
var category = packageGraph.publicPackages.first.categories.first;
728728
expect(category.linkedName,
729-
'<a href="${htmlBasePlaceholder}topics/Superb-topic.html">Superb</a>');
729+
'<a href="${htmlBasePlaceholder}topics/Excellent-topic.html">Superb</a>');
730730
});
731731
});
732732

tool/task.dart

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import 'package:analyzer/file_system/physical_file_system.dart';
99
import 'package:args/args.dart';
1010
import 'package:collection/collection.dart';
1111
import 'package:crypto/crypto.dart' as crypto;
12-
import 'package:dartdoc/src/io_utils.dart';
1312
import 'package:dartdoc/src/package_meta.dart';
1413
import 'package:path/path.dart' as path;
1514
import 'package:sass/sass.dart' as sass;
@@ -497,12 +496,7 @@ Future<void> docSdk({bool withStats = false}) async => _docSdk(
497496
Map<String, String> createThrowawayPubCache() {
498497
var pubCache = Directory.systemTemp.createTempSync('pubcache');
499498
var pubCacheBin = Directory(path.join(pubCache.path, 'bin'));
500-
var defaultCache = Directory(_defaultPubCache);
501-
if (defaultCache.existsSync()) {
502-
io_utils.copy(defaultCache, pubCache);
503-
} else {
504-
pubCacheBin.createSync();
505-
}
499+
pubCacheBin.createSync();
506500
return Map.fromIterables([
507501
'PUB_CACHE',
508502
'PATH',
@@ -512,9 +506,6 @@ Map<String, String> createThrowawayPubCache() {
512506
]);
513507
}
514508

515-
final String _defaultPubCache = Platform.environment['PUB_CACHE'] ??
516-
path.context.resolveTildePath('~/.pub-cache');
517-
518509
Future<String> docTestingPackage({
519510
bool withStats = false,
520511
}) async {

0 commit comments

Comments
 (0)