Skip to content

Refactor tutorials#6417

Closed
Andrew15-5 wants to merge 4 commits intotypst:mainfrom
Andrew15-5:advanced-refactor
Closed

Refactor tutorials#6417
Andrew15-5 wants to merge 4 commits intotypst:mainfrom
Andrew15-5:advanced-refactor

Conversation

@Andrew15-5
Copy link
Contributor

Closes #6273.

I can try splitting this into multiple commits, if needed. There are plenty of stuff to discuss. The main blocker is #6416, i.e., the block + hyphenate thing. I included a few comments.

For the most part, this is ready for review/merge.

@Andrew15-5
Copy link
Contributor Author

Andrew15-5 commented Jun 12, 2025

In https://typst.app/docs/tutorial/formatting/#show-rules, I would redo that as

#show "ArtosFlow": name => {
  let logo = box(image(
    "logo.svg",
    height: 0.7em,
  ))
  [#logo #name]
}

but let keyword is only mentioned in https://typst.app/docs/tutorial/advanced-styling/#title-and-abstract.

I guess it's fine, but what I don't understand is why this doesn't introduce the 2 additional spaces? Is it just because the spaces are collapsed like in word #[ word ] word? If so, then this example just happen to not be affected by the [] block spaces. This is bad.

It doesn't add the spaces even if the word is surrounded by periods. Does box somehow trim the spaces?

#show "ArtosFlow": name => {
  box(image(
    "logo.svg",
    height: 0.7em,
  ))
  " "
  name
}

would be better, but it's not exactly as nice and readable as [#logo #name].

The current example also has implicit space in-between that is not explained either.

@Andrew15-5
Copy link
Contributor Author

Andrew15-5 commented Jun 12, 2025

In https://typst.app/docs/tutorial/writing-in-typst/#figure, I tried adding box to caption content block, and it removed the extra spaces. This is definitely not a documented behavior, that looks very handy, if it's not a bug or something.

But also adding box and func[] breaks the flow, and it's all introduced only in https://typst.app/docs/tutorial/formatting.


Adding box to https://typst.app/docs/tutorial/advanced-styling and including title into PDF metadata does not in fact trim the spaces. So it's not as universal and robust as I thought.

@Andrew15-5 Andrew15-5 changed the title Refactor "Advanced Styling" tutorial Refactor tutorials Jun 12, 2025
@Andrew15-5
Copy link
Contributor Author

Andrew15-5 commented Jun 12, 2025

Can I add heading show rule example fix from https://typst.app/docs/reference/styling/#show-rules here? The example in https://typst.app/docs/guides/guide-for-latex-users/#templates copies the tutorial example, so it also uses the outdated syntax, even though it's not visible.

@laurmaedje
Copy link
Member

It's a bit unfortunate timing for a cleanup as we are planning to rewrite the tutorial completely from scratch soon.

@Andrew15-5
Copy link
Contributor Author

Andrew15-5 commented Jul 22, 2025

Rewrite in Typst?

I don't really mind, as long as instances such as #6273 (basically what this PR fixes) are gone (addressed). The idea is to eliminate bad examples that users can then cite as an inspiration for bad code (practices), i.e., so that everyone can learn the right way from the very beginning. Which should also help a bit with forum (fewer things to fix, fewer things that introduces issues and hard to debug).

@laurmaedje
Copy link
Member

Rewrite as in completely rewrite the content. Because the current one kinda sucks. We'll make sure to check your suggestions while writing the new one.

@Andrew15-5
Copy link
Contributor Author

Oh, so it's still in Markdown... Well, then it's still cool, just not extra cool.

I guess you can add attribution to some commits if you will get some parts out of my PR.

You can set me as a reviewer, would be interesting to see how it will turn out. As always, I might have some polish changes by the time I read through it.

@Andrew15-5
Copy link
Contributor Author

To update, the tutorials rewrite was postponed by the new releases, but it's back on the menu, and it's being worked on. No clear dates.

Context:

We were pretty busy with the release recently, so the tutorial project stalled a bit. But it's back in focus now.

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.

Non-idiomatic advanced heading styling in documentation

2 participants