blob: 15ad23121c9f78468d7f94826615c0da60fe7488 [file] [log] [blame]
// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import '../ast.dart';
import '../block_parser.dart';
import 'block_syntax.dart';
import 'header_syntax.dart';
/// Parses atx-style headers, and adds generated IDs to the generated elements.
class HeaderWithIdSyntax extends HeaderSyntax {
const HeaderWithIdSyntax();
@override
Node parse(BlockParser parser) {
final element = super.parse(parser) as Element;
element.generatedId = BlockSyntax.generateAnchorHash(element);
return element;
}
}