How to dynamically hide asciidoc element

asciidoctor stylesheet
asciidoctor table
asciidoc image size
asciidoc toc levels
asciidoc discrete
asciidoctor backends
asciidoc section numbering
asciidoctor book

I use org.asciidoctor.convert plugin for gradle to generate API documentation for my team. I include files:


and want to place it's content into spoiler or anything like that. Is there any way to somehow hide dynamicaly asciidoc elements? I try to use

pass:[<details open>  

but it is not processed include inside it. Any ideas will be higly appreciated. Without hiding snippets my documentation have almost unlimited scrol :). If no such way with ascii doc, suggestions of other documentation formats, where i can include files content and place it into the spoiler is also appreciated.

As this was so helpful for me - I added here the solution from Robin's comment.

No CSS and Javascript needed!

Here is an example:

+++ <details><summary> +++
Check `reference.conf`:
+++ </summary><div> +++
play {
  http {
    secret.key = asdf
    secret.key = ${?SECRET_KEY}
+++ </div></details> +++

This creates a collapsed element:

..and this expanded image:

Asciidoctor User Manual, However, the TOC is no more dynamic than it was previously. a.toc-link{ height:​100% } .is-collapsible{ max-height:3000px; overflow:hidden; }  How to dynamically hide asciidoc element. 7. how to define own asciidoc macro. 4. asciidoc: Including bold inside Code Fence. 0. Highlight some code lines with

As Guillaume Grossetie has mentioned here

Using passthrough to include raw HTML is not recommended because now your document is tightly coupled with the output.

and it is deprecated. The new syntax for collapsible/foldable sections is

.some description
to be

Add expandable/collapsable TOC · Issue #699 · asciidoctor , I'm writing a tutorial and trying to generate the final source code file out of an Asciidoctor text so the two are always in sync. This works great  Purpose: Demonstrate the scenario of hiding view UI elements and aligning the elements in view layout dynamically by using recursive search Scenario: If we need to hide some view ui elements from layout dynamically, there is always the issue with the alignement of view ui elements.

Hide source block `tag`/`end` entries from HTML output · Issue , The 'title' element in HTML outputs is set to the AsciiDoc document title, you are generated dynamically by the JavaScript TOC generator *after* the page is loaded. 'controls' are enabled, include the 'nocontrols' option value to hide them. AsciiDoc is a plain text human readable/writable document format that can be translated to DocBook or HTML using the asciidoc(1) command. You can then either use asciidoc(1) generated HTML directly or run asciidoc(1) DocBook output through your favorite DocBook toolchain or use the AsciiDoc a2x(1) toolchain wrapper to produce PDF, EPUB, DVI, LaTeX, PostScript, man page, HTML and text formats.

AsciiDoc User Guide, Accordingly, we need to hide the associated <div> — in this case, with hidden . We don't need to add role="button" because the <button> element implicitly has Let's use pushState to dynamically change the URL without  This guide describes the basic structure of an AsciiDoc document, how to create your first AsciiDoc document, how to add other structural elements such as lists, block quotes and source code, and how to convert an AsciiDoc document to HTML, DocBook and PDF.

this AsciiDoc file, A document can include the following block elements: When the hide-uri-​scheme attribute is set, the above URL will render as follows: To fix this, you can reference a dynamic variable from the main document in the ID. Fullscreen Video Modal Boxes Delete Modal Timeline Scroll Indicator Progress Bars Skill Bar Range Sliders Tooltips Display Element Hover Popups Collapsible Calendar HTML Includes To Do List Loaders Star Rating User Rating Overlay Effect Contact Chips Cards Flip Card Profile Card Product Card Alerts Callout Notes Labels Circles Style HR Coupon

Collapsible Sections, When the ngHide expression evaluates to a truthy value then the .ng-hide CSS class is added to the class attribute on the element causing it to become hidden. The following asciidoc features are the key for implementing dynamic showing/hiding of blocks: If your output is only HTML then you can embed any HTML in the document using ++++ any HTML contents ++++ This includes <style> tags containing custom CSS classes; custom HTML tags for show/hide functionality like <input type="checkbox" />

  • Are you adding the includes into a block, like a source block? If you are you can add roles to the resultant element then style / use javascript to do the rest.
  • This is not rendered on Github
  • This works almost fine on vscode except it doesn't show the syntax highlighting properly. Atom editor has a far better layout and syntax highlighting but has issues with this feature plus it takes ages to render! All in all thanks a lot :)
  • This was very useful! I actually used this to wrap lengthy snippets includeed from other files - see below - note it seems three pluses +++ not four is what you need: +++ <details><summary> +++ Some long text summarised +++ </summary><div> +++ include::snippets/some-long-text.adoc[] +++ </div></details> +++
  • @Robin I was trying your suggestion and the wrap works, but the include is displayed as "include...", not rendered to the snippet.
  • @LisaMM I'm not sure why that would be, but it sounds like a parse error. You can see examples of my suggestion here:… - and the end result (after having been parsed in HTML with ASCIIdoctor) here:…
  • @Robin I must have missed something on my first try, because I tried again the next day and now it works :)