Skip to content

Resolve #1141: Add hint for missing numbering, improve hint format consistency - #1456

Merged
laurmaedje merged 5 commits into
typst:mainfrom
Mafii:heading-diagnostics
Jun 12, 2023
Merged

laurmaedje merged 5 commits into
typst:mainfrom
Mafii:heading-diagnostics

Conversation

@Mafii

@Mafii Mafii commented Jun 10, 2023 •

Copy link
Copy Markdown
Contributor

I kept the recommendation really short, as codespan reporting recommends:

Message: These should not include line breaks, and in order support the ‘short’ diagnostic display mod, the message should be specific enough to make sense on its own, without additional context provided by labels and notes.

I think it would make sense to have a way to report additional recommendations/fixes internally, so that the message can contain multiple parts while adhering to the codespan reporting recommendations. Maybe using codespan reporting's notes?

How to reproduce:

Create a .typ file with the following content:

= Introduction <intro>
In @intro, we see how to turn
Sections into Chapters. And
in @intro[Part], it is done
manually.

The content is straight out of the example for headings, with the #set heading(numbering: "1.") removed.

The user get's shown the following message now:

image

Is a test for this needed? If so, I'll happily write one.

This is my first contribution here, so if there is anything I can do better, no matter what, feel free to tell me!

@laurmaedje

Copy link
Copy Markdown
Member

I want to have better infrastructure for tips like this, but for now this is fine. One change I'd like to see is to have everything lowercase.

Regarding the separator between message and hint: We currently have two such "did you" hints. One is separate with a period and one with a colon and en-dash. Already inconsistent... I do not have a strong preference either way, so .

@Mafii
Mafii force-pushed the heading-diagnostics branch from 706a202 to 3b8ff05 Compare June 10, 2023 17:14
@Mafii

Mafii commented Jun 10, 2023 •

Copy link
Copy Markdown
Contributor Author

One change I'd like to see is to have everything lowercase.

Done

Regarding the separator between message and hint: We currently have two such "did you" hints. One is separate with a period and one with a colon and en-dash.

I've decided to streamline all to use a normal - character. I think it's reasonable to use the ascii character here, not the en-dash.
Hope that's okay! I'm happy to change it to any other variant if you want.

I want to have better infrastructure for tips like this, but for now this is fine.

If I find the time, would you be happy to accept a PR for that? I'll happily experiment if there's a convenient way of doing this.

Edit: I just realized there's other en-dashes in messages - should I replaced them too while I'm at it, or is the en-dash preferred?

Edit 2: I've added a test for this hint, I hope the hint.typ file is the correct location?

@Mafii Mafii changed the title Fix #1141: Add additional help for missing numbering Resolve #1141: Add additional help for missing numbering Jun 10, 2023
@laurmaedje

laurmaedje commented Jun 10, 2023 •

Copy link
Copy Markdown
Member

I'm with you on using normal ASCII instead of en-dashes. Feel free to go ahead and replace that, too.

hint.typ is good.

@Mafii

Mafii commented Jun 11, 2023

Copy link
Copy Markdown
Contributor Author

I did a full text search for en- and em-dashes, the one in 3d6f63e seems to be the last one that was not the ASCII character already.

@Mafii Mafii changed the title Resolve #1141: Add additional help for missing numbering Resolve #1141: Add hint for missing numbering Jun 11, 2023
@Mafii Mafii changed the title Resolve #1141: Add hint for missing numbering Resolve #1141: Add hint for missing numbering, improve message consistency Jun 11, 2023
@Mafii Mafii changed the title Resolve #1141: Add hint for missing numbering, improve message consistency Resolve #1141: Add hint for missing numbering, improve hint format consistency Jun 11, 2023
@laurmaedje

laurmaedje commented Jun 12, 2023 •

Copy link
Copy Markdown
Member

If I find the time, would you be happy to accept a PR for that? I'll happily experiment if there's a convenient way of doing this.

I would be!

@laurmaedje
laurmaedje merged commit 93e6638 into typst:main Jun 12, 2023
@laurmaedje

Copy link
Copy Markdown
Member

Thanks!

Dikluwe pushed a commit to Dikluwe/typst-crystalline that referenced this pull request Sep 12, 2026
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