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

Provide folding range for sibling attributes #723

Merged
merged 1 commit into from
Jun 17, 2023

Conversation

apupier
Copy link
Member

@apupier apupier commented Jun 16, 2023

part of #719

basic use case covered, other cases potentially to cover:

  • include comment lines
  • include emtpy lines
MoreThan2AttributesFoldingDemo.mp4

part of asciidoctor#719

basic use case covered, other cases potentially to cover:
- include comment lines
- include empty lines

Signed-off-by: Aurélien Pupier <[email protected]>
@apupier apupier marked this pull request as ready for review June 16, 2023 12:11
@ggrossetie
Copy link
Member

I think the only uncovered use case is a multi-line attribute:

= Document
:description: If you have a very long line of text \
that you need to substitute regularly in a document, \
you may find it easier to split the value neatly in the header \
so it remains readable to folks looking at the AsciiDoc source.
:attr2: value
:attr3: value

content

@ggrossetie
Copy link
Member

1. include comment lines

I don't know about that. I think a comment is an indication that attributes are "grouped":

= Document
// urls
:url-foo: foo
:url-bar: bar
// built-in
:toc:
:author: Aurélien

content

We might want to fold all document attributes at once but I think we should also allow to fold each "group".

2. include empty lines

It's important to note that:

The document header may not contain empty lines. The first empty line the processor encounters after the document header begins marks the end of the document header and the start of the document body.

https://docs.asciidoctor.org/asciidoc/latest/document/header/#document-header-structure

It might be misleading if we fold all attributes in the document header:

= Document
:doc-attr1: value
:doc-attr2: value

:not-doc-attr: value

content

For attributes defined in the body I think it's fine:

= Document
:attr1: value
:attr2: value

content

:body-attr1: value
:body-attr2: value

:body-attr3: value
:body-attr4: value

more content

But again it makes sense to fold per "group". I think that's the whole purpose of adding an empty line, to visually create two groups of attributes.

Anyway, we can discuss that in follow-up issues.

@ggrossetie ggrossetie merged commit 574e9f1 into asciidoctor:master Jun 17, 2023
@apupier apupier deleted the 719-folding branch June 19, 2023 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants