Skip to content

Add a hideConstantImplementations dartdoc directive #3398

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
May 4, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 6.2.1-dev

## 6.2.1
* Do not show induced modifiers from analyzer in class headers.
(#3371)
Expand Down
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,41 @@ markdown link isn't linked).
It's best to only inject HTML that is self-contained and doesn't depend upon
other elements on the page, since those may change in future versions of Dartdoc.

### Skipping constant rendering with one-line docs

For some classes or libraries full of well-documented constants, showing the
implementation on the enclosing `class` or `library` page can be distracting
or even misleading. To prevent the rendering of constant implementations,
place the `{@hideConstantImplementations}` in the documentation comment for
the enclosing context where the constant is defined. For members of a class,
place the directive in the class documentation where the constants are defined.
For top level constants, place the directive in the library where the constants
are defined.

For example:

```dart
/// This is truly an amazing library.
/// {@hideConstantImplementations}
library my_library;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I think we're steering away from named libraries like this; we can use library; in Dart 2.19.


/// This top level constant will not show its implementation.
const a = 7;

/// {@hideConstantImplementations}
class A {
/// This constant will not show its implementation.
static const aConst = 12;
}

class B {
/// Despite the library directive, because this is a class
/// member and there is no hideConstantImplementations
/// directive on the class, we will show this implementation.
static const bConst = 27;
}
```

### Auto including dependencies

If `--auto-include-dependencies` flag is provided, dartdoc tries to automatically add
Expand Down
2 changes: 1 addition & 1 deletion dartdoc_options.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dartdoc:
linkToSource:
root: '.'
uriTemplate: 'https://github.com/dart-lang/dartdoc/blob/v6.2.1/%f%#L%l%'
uriTemplate: 'https://github.com/dart-lang/dartdoc/blob/v6.2.1-dev/%f%#L%l%'
Loading