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

🔢 Enable continuous numbering across pages #1391

Merged
merged 29 commits into from
Jan 23, 2025
Merged

Conversation

fwkoch
Copy link
Collaborator

@fwkoch fwkoch commented Jul 14, 2024

This adds an extra key to numbering fields - continue. If true, the numbering of that type will continue counting from the previous page.

This also adds title/page-level enumeration (which, combined with continue means you can have numbered chapters).

Finally, this cleans up how frontmatter numbering heading_# relates to page heading depths. Now, the user-defined frontmatter levels match the user-defined heading depths, even if transforms have changed the depths in the mdast (for normalization, title lifting, etc).

@agoose77
Copy link
Contributor

What is this blocked on? Can I help in any way?

@rowanc1
Copy link
Member

rowanc1 commented Aug 23, 2024

I think it was blocked on requirements as we got a bit confused on how to actually do it!

@rowanc1 rowanc1 added the blocked Waiting for another task to be compled label Aug 28, 2024
@fwkoch
Copy link
Collaborator Author

fwkoch commented Sep 4, 2024

I don't think there is anything critical blocking this - I just stepped away from it and have not come back. The biggest thing I could use some input on is the frontmatter fields:

In numbering on a page, you can now specify start: <number> (if you want to start counting at a specific number) or continue: true (if you want to continue counting from the previous page). However, as these are separate fields, you can specify both, e.g.:

numbering:
  figure:
    start: 3
    continue: true

In that case, it is ambiguous which takes priority. So, I think we should reconsider this frontmatter so this ambiguity is not possible. Maybe that means start: number | 'continue' or something? So you can either specify a starting number or say "continue from previous page." Or, we could just leave start and continue but introduce a validation error if both are defined... Or maybe something else?

Beyond that, this PR just needs some more testing and bug fixing - the continuous numbering still doesn't quite work as expected everywhere.

@fwkoch fwkoch force-pushed the feat/continuous-numbering branch from d1e74dc to e756be7 Compare January 9, 2025 17:22
Copy link

changeset-bot bot commented Jan 9, 2025

🦋 Changeset detected

Latest commit: c31f811

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
myst-frontmatter Patch
myst-transforms Patch
myst-spec-ext Patch
myst-common Patch
myst-cli Patch
myst-config Patch
mystmd Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@rowanc1 rowanc1 removed the blocked Waiting for another task to be compled label Jan 9, 2025
@rowanc1
Copy link
Member

rowanc1 commented Jan 9, 2025

Picking this back up with franklin to get it over the line now!

@fwkoch fwkoch force-pushed the feat/continuous-numbering branch from 854987e to 339bbda Compare January 18, 2025 05:34
@fwkoch
Copy link
Collaborator Author

fwkoch commented Jan 20, 2025

This is finally ready to go - a lot in here is not pretty, but there are quite a few new end-to-end test cases to test the new functionality.

A bunch of enhancements still need to come for more flexibility with numbering:

@fwkoch
Copy link
Collaborator Author

fwkoch commented Jan 20, 2025

Related small theme pr: jupyter-book/myst-theme#525

@rowanc1
Copy link
Member

rowanc1 commented Jan 23, 2025

OK - this is good to go! Been testing with @fwkoch interactively for the last few days and pretty happy with these new capabilities. There is more to do, but this is a bit step forward.

@rowanc1 rowanc1 merged commit 614ed0e into main Jan 23, 2025
7 checks passed
@rowanc1 rowanc1 deleted the feat/continuous-numbering branch January 23, 2025 19:40
@paulskrzypczyk
Copy link

not sure if this is the correct place to post (apologies in advance if it is wrong).

After this update, all my exercises are now continue to number across pages. For example, in chapter 2, my first exercise is now 2.5, whereas previously it was 2.1. I haven't changed anything, so is this the expected behaviour or a bug? From what I'm ready above, I thought the default behaviour would be to reset the numbering within in chapter (as previously?) If this isn't a bug, could you advise on what I need to add to change the behaviour?

@fwkoch
Copy link
Collaborator Author

fwkoch commented Jan 27, 2025

@paulskrzypczyk - your post here is great. I appreciate the report.

It does sound like bug rather than something you need to change - I need to investigate a little further and follow up.

@fwkoch
Copy link
Collaborator Author

fwkoch commented Jan 27, 2025

@paulskrzypczyk - Ok, I tried to recreate this in one of your repositories (https://github.com/paulskrzypczyk/qm-lecturenotes-new), but for that one, the numbering behaved as I expected. Running myst start with no changes to frontmatter, numbers reset:

image

then setting equations: continue under numbering I get the continuous numbering:

image

Can you point me to the specific project where you are seeing this issue? Or if it's private, maybe a minimal example?

@paulskrzypczyk
Copy link

Hi Franklin, it is the exercise numbering which is continuous, not the equations (which are numbering correctly). It is indeed the repo you're looking at. At the end of each chapter you'll see a collection of exercises. In chapter, I now see

image

and in chapter 3

image

etc

Hope this helps clarify

@fwkoch
Copy link
Collaborator Author

fwkoch commented Jan 27, 2025

Thank you - yes I just noticed that 😅 And I do see the same behavior.

@fwkoch
Copy link
Collaborator Author

fwkoch commented Jan 28, 2025

@paulskrzypczyk - This should be fixed here: #1824 - I'll get that released tonight or tomorrow morning!

Thanks again for reporting the issue! (And sorry for my poor reading comprehension, hah.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants