Replies: 1 comment
-
|
A configured prefix to hide line could be used as well. This could be reused to implement expandable easily. # import { http, createPublicClient } from 'viem'
import { mainnet } from 'viem/chains'Would only render to: import { mainnet } from 'viem/chains'<code class="vocs_Code hide">
<span class="line vocs_Span hidden">"import { http, createPublicClient } from 'viem'"</span>
<span class="line vocs_Span">"import { mainnet } from 'viem/chains'"</span>
</code>.hide .hidden {
display: none;
}An |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Extend the
!includemarker with:!include_focus: all the content of the file is imported, but!code focusaction is applied on each line of the imported content. All the// [!region]comments are deleted as well.!include_expandable: Same behaviors as!include_focus, however initially all the non focused part of the code block is collapsed. A small toggle icon allows to expand/collapse the content outside of the imported region.Mdbook has this feature with #rustdoc_include.
Not sure if possible, but we could also consider abstracting the applied actions:
[!include path(:region)?( action)*] would apply the list of actions to the imported content (all the file or just the region if specified). With this, implement
expandaction separately from!includemarker (Slightly related to #225).Example
With the following snippet:
Markdown page:
Result:
With
!include_expandable:Result:
With a button to switch between this and
!include_focusresult.Beta Was this translation helpful? Give feedback.
All reactions