/*! * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {Token, Tokens, RendererThis, TokenizerThis} from 'marked'; import {formatHeading} from '../../tranformations/heading.mjs'; interface DocsStepToken extends Tokens.Generic { type: 'docs-step'; title: string; body: string; tokens: Token[]; } // Capture group 1: all attributes on the opening tag // Capture group 2: all content between the open and close tags const stepRule = /^\s*]*)>((?:.(?!\/docs-step))*)<\/docs-step>/s; const titleRule = /title="([^"]*)"/; export const docsStepExtension = { name: 'docs-step', level: 'block' as const, start(src: string) { return src.match(/^\s* ${formatHeading({text: token.title, depth: 3})} ${this.parser.parse(token.tokens)} `; }, };