Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Block Macros are not collapsible in Confluence, even with the collapse parameter included #58

Closed
tyler-copilot opened this issue Jan 20, 2021 · 4 comments
Labels

Comments

@tyler-copilot
Copy link
Contributor

I have some long code listings that I'd like to turn into collapsible code blocks in confluence. When I use the collapse parameter of the standard/included code block macro, it is not collapsible. However, I can accomplish this easily in the WSYWIG editor using the /expand macro and putting a regular code block inside it. I've tried defining it as a macro, but my ac:* markup is stripped out. Wiki syntax doesn't seem to be supported either {expand} so I'm not sure how to do this.

Is there a better/simpler way to do this, or even just a workaround that I'm not aware of?

@kovetskiy
Copy link
Owner

Hi, unfortunately, I'm not aware of the solution. I'll keep the issue open, maybe someone else knows how to do it.

@tyler-copilot
Copy link
Contributor Author

tyler-copilot commented Jan 25, 2021

How would I define a Go template that outputs an /expand with a title, wrapped around a regular code block? I've tried several things, but you don't have any examples of how to add custom macros that can accept "body" text. What documentation can I look at to determine what Confluence macros are valid to access?

@tyler-copilot
Copy link
Contributor Author

This is a listing of the "storage format" exported by my Confluence instance. Notice how you are using <ac:structured-macro ac:name="code" ... I think what I want is to wrap that block with the macro named "expand" as well, and title it.

<p>This Confluence page is auto-generated from REDACTED using <a href="/~https://github.com/kovetskiy/mark">/~https://github.com/kovetskiy/mark</a> (Do not directly edit it in Confluence, as your changes will be overwritten).</p>


<h1>Table of Contents</h1>


<p><ac:structured-macro ac:name="toc" ac:schema-version="1" ac:macro-id="92fc4de1-b680-479d-acb1-371587b512b1"><ac:parameter ac:name="maxLevel">7</ac:parameter><ac:parameter ac:name="minLevel">1</ac:parameter><ac:parameter ac:name="outline">clear</ac:parameter><ac:parameter ac:name="style">disc</ac:parameter><ac:parameter ac:name="type">list</ac:parameter><ac:parameter ac:name="printable">true</ac:parameter><ac:parameter ac:name="include" /><ac:parameter ac:name="indent" /><ac:parameter ac:name="exclude" /></ac:structured-macro></p>


<h2>Logging</h2>
<ac:structured-macro ac:name="code" ac:schema-version="1" ac:macro-id="e791e11a-c803-48c2-ba0a-e33f08a0592d"><ac:parameter ac:name="language">javascript</ac:parameter><ac:parameter ac:name="title">Logging: enable (Jul 8, 2019)</ac:parameter><ac:parameter ac:name="collapse">true</ac:parameter><ac:plain-text-body><![CDATA[document.cookie = "verbose=1";

]]></ac:plain-text-body></ac:structured-macro>

@tyler-copilot
Copy link
Contributor Author

tyler-copilot commented Jan 25, 2021

I tried to define a Go template like this:
<ac:structured-macro ac:name="expand"><ac:parameter ac:name="title">{{.title}}</ac:parameter><ac:rich-text-body><ac:structured-macro ac:name="code"><ac:parameter ac:name="language">javascript</ac:parameter><ac:plain-text-body><![CDATA[<!-- Include: ./doc/snippets/{{.filename}} -->]]></ac:plain-text-body></ac:structured-macro></ac:rich-text-body></ac:structured-macro>

but the output was corrupted by an invalid </p>

I will send a pull request.

tyler-copilot added a commit to tyler-copilot/mark that referenced this issue Jan 25, 2021
kovetskiy added a commit that referenced this issue Feb 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants