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
aidialog PR #55 preserves notebook directives such as code-fold and code-summary as data-code-fold and data-code-summary attributes on Markdown code fences. This keeps the display settings available without making aidialog decide how code should appear on the page.
This PR adds a code_block callback to mdhtml’s existing rewrite() API. So Octavo can use it to read those attributes and wrap code in a collapsed section with the requested label. Other callers can use the same callback for their own code-block transformations.
Hey @RensDimmendaal - I refactored the machinery you're using here a bit over the last week, so I think/hope everything you need is now available, without needing this PR.
Code-block transformations are supported through rewrite(src, {'code_block': callback}), including nested blocks in lists and blockquotes. For fenced code, the callback receives info, lang, text, parsed attrs (id, classes, and pairs), plus source and character offsets. It can inspect those attributes and return replacement Markdown. Replacements preserve the orig prefixes and final newline. This provides code-folding transformations without a separate API. (Also, I've now used it to add the GFM fence-info normalization thingie you had.)
Lemme know if I've missed anything you need, or you have any q's.
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
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.
aidialog PR #55 preserves notebook directives such as
code-foldandcode-summaryasdata-code-foldanddata-code-summaryattributes on Markdown code fences. This keeps the display settings available without making aidialog decide how code should appear on the page.This PR adds a
code_blockcallback to mdhtml’s existingrewrite()API. So Octavo can use it to read those attributes and wrap code in a collapsed section with the requested label. Other callers can use the same callback for their own code-block transformations.