Skip to content
This repository has been archived by the owner on Jun 8, 2024. It is now read-only.

Unstable indentation calcultation #120

Open
drupol opened this issue Oct 31, 2023 · 2 comments
Open

Unstable indentation calcultation #120

drupol opened this issue Oct 31, 2023 · 2 comments

Comments

@drupol
Copy link

drupol commented Oct 31, 2023

Hello,

When running typstfmt on this snippet:

#focus-slide[
  #fit-to-height(3em)[Introduction]

  #pdfpc.speaker-note(```
    Let's start the introduction with a quote from Foo Bar
  ```)
]

the resulting output is:

#focus-slide[
  #fit-to-height(3em)[Introduction]

  #pdfpc.speaker-note(```
      Let's start the introduction with a quote from Ken Thompson
    ```)
]

I believe that there's an issue in the #pdfpc.speaker-note handling.
Also, when running multiple times the formatter on that example, the indentation never stops growing, after a couple of times, it become:

#focus-slide[
  #fit-to-height(3em)[Introduction]

  #pdfpc.speaker-note(```
                    Let's start the introduction with a quote from Ken Thompson
                  ```)
]
@drupol drupol changed the title Invalid indentation when using it in Unstable indentation calcultation Oct 31, 2023
@astrale-sharp
Copy link
Owner

Thanks a lot for the report!
I'll investigate !

@astrale-sharp
Copy link
Owner

astrale-sharp commented Oct 31, 2023

This is a hard problem to solve right now.

format_content_blocks adds an indent to everything inside a content block and since it still valid spaces for the raw block, it "absorbs" them.

A temporary solution could be to disable indenting inside markup blocks (possibly only if it contains raw text!

I went ahead and implemented this temporary solution here 6974e5d, ideally, the program could be smart enough to only indent where there is no raw text

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants