You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Continuing the conversation from #4371, the goal is to create a parser that accepts markdown as input as spits out a list of headings that can be easily formatted into a table of contents or similar.
The TocNode is an incomplete API for this use case: it doesn't hold the content, it was created for a different reason, and while it could be simple to reuse it, it may be better to just have a clean start. As we really want to use this for changelog parsing too, it could be a better starting point to collect different kind of requirements for that and how it would look in a parsed form.
/// Describes a tree node in the table of contents hierarchy.
classTocNode {
/// The text label to be display.
finalString label;
/// The link href to use, if omitted, only a regular text is displayed.
finalString? href;
/// Children nodes of this node.
List<TocNode>? children;
TocNode(
this.label, {
this.href,
this.children,
});
}
Can you elaborate here:
Why is the content needed? For either the changelog or details page, isn't it enough to just have the title be a clickable link? Right now it is a string, I can definitely change it to be a markdown Node, but I don't see where we'd want the content to be
What exactly do we want for the Changelog page? A similar ToC of all releases? Should we nest for major/minor/patches? That would be tricky if the author did not use nested headers. I went through some older issues and PRs and couldn't really find a clear description of exactly what's wanted here
Should I make my new API be the new TocNode and refactor the admin page to use that?
The text was updated successfully, but these errors were encountered:
I opened #8348 with my first pass at the parser, marked as draft because I know you still have some points to address. Here's the new API:
/// A node of the Table of ContentsclassTocNode {
/// What level heading this node is. /// /// This is not defined by what tag it is using, or how many `#` it has, but rather /// how many levels of nesting have occurred in the document so far. That is to say, /// /// ```md /// # Level 1 /// ### Level 2 /// ##### Level 3 /// ```int level;
/// The list of [TocNode] that are nested under this heading.List<TocNode> children;
/// The title of the node, as a string.finalString title;
/// The parent heading for this node.TocNode? parent;
}
Continuing the conversation from #4371, the goal is to create a parser that accepts markdown as input as spits out a list of headings that can be easily formatted into a table of contents or similar.
@isoos From the other thread:
For reference, here is the
TocNode
class:pub-dev/app/lib/frontend/templates/views/shared/toc.dart
Lines 35 to 51 in 4acdc2b
Can you elaborate here:
Node
, but I don't see where we'd want the content to beTocNode
and refactor the admin page to use that?The text was updated successfully, but these errors were encountered: