Repository navigation
Conversation
A line starting with `<!--` (CommonMark HTML block kind 2) and every line up to the one with `-->` draws nothing, as on GitHub; an unclosed comment runs to the end of the document. Definitions inside a comment are not taken. Inline `<!-- … -->` in a paragraph, heading or cell is dropped too (one space kept between the words around it); an unclosed one stays text. HTMLBlockSyntax.swift is the new home of block-level HTML recognizers.
`<details>` / `<details open>` with a `<summary>` (on its own line, on the opening tag's line, or over several lines) is a collapsible section: the summary row has a disclosure triangle (GitHub's filled one), and a click on the triangle or the caption shows or hides the Markdown blocks inside. Both show the pointing hand and say "Expand" or "Collapse". Nesting works; a `<details>` without a summary reads "Details"; an unclosed one runs to the end of the document; a stray `</details>` draws nothing. Simple inline tags in a summary (`<b>`, `<i>`, `<code>`, ...) become Markdown, others are dropped. Print and PDF show every section open. Design, so more HTML tags can follow: - HTMLBlockSyntax has a generic tag lexer and a registry of container tags (`containerTags` + `HTMLContainerKind`); `<details>` is its first entry. - The parser keeps one flat block list and tags each block with the containers it is inside (`MarkdownBlock.containers`); the summary row is a text block with `opensContainer`, so it is measured, searched, selected and copied like any text. Its caption carries a toggle link. - The row is [triangle][caption]: the measurer wraps the caption at the column less the triangle's (`BlockLayout.ContainerSummary`), and the triangle is a small AppKit view beside the text view, never over it, so it owns its click, cursor and tooltip. - The view hands the list a `ContainerPresentation`: the blocks of closed containers left out, the height table cut to match and the spacing after a hidden run derived again. Search, the table of contents and anchors still see every block; jumping to a hidden one opens the containers around it first. Toggles survive a re-parse.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat:
<details>blocks collapse and expand<details>/<details open>with a<summary>(on its own line, on theopening tag's line, or over several lines) is a collapsible section: the
summary row has a disclosure triangle (GitHub's filled one), and a click
on the triangle or the caption shows or hides the Markdown blocks inside.
Both show the pointing hand and say "Expand" or "Collapse". Nesting works;
a
<details>without a summary reads "Details"; an unclosed one runs tothe end of the document; a stray
</details>draws nothing. Simple inlinetags in a summary (
<b>,<i>,<code>, ...) become Markdown, othersare dropped. Print and PDF show every section open.
Design, so more HTML tags can follow:
tags (
containerTags+HTMLContainerKind);<details>is its firstentry.
containers it is inside (
MarkdownBlock.containers); the summary rowis a text block with
opensContainer, so it is measured, searched,selected and copied like any text. Its caption carries a toggle link.
column less the triangle's (
BlockLayout.ContainerSummary), and thetriangle is a small AppKit view beside the text view, never over it,
so it owns its click, cursor and tooltip.
ContainerPresentation: the blocks ofclosed containers left out, the height table cut to match and the
spacing after a hidden run derived again. Search, the table of contents
and anchors still see every block; jumping to a hidden one opens the
containers around it first. Toggles survive a re-parse.