Skip to content

Add support for HTML books#16

Merged
KnightMiner merged 96 commits intoSlimeKnights:html-bookfrom
paypur:master
Apr 18, 2026
Merged

Add support for HTML books#16
KnightMiner merged 96 commits intoSlimeKnights:html-bookfrom
paypur:master

Conversation

@paypur
Copy link
Copy Markdown

@paypur paypur commented Jul 16, 2025

I think I'm pretty close to being done, so here's what I have. There's definitely even more that can be done, like the tooltips we talked about, but that will have to be for later.

Preview: https://paypur.github.io/docs/books/1.20/
Tinkers' PR: SlimeKnights/TinkersConstruct#5456
Mantle PR: SlimeKnights/Mantle#231

Notes

  • PageContent's should override toHTML
  • The auto-generated HTML is not very readable but I'm not sure if you care because you shouldn't manually edit it
  • CSS is written assuming scale = 2, but this should be easy to change
  • The old images are still there for comparing
  • All images have been index with 8-bit color (if possible) then losslessly compressed
  • Exporting has been split off into /mantle book export_html
  • The book "chapters" feel kinda redundant now that we can just link to a specific page on an image
  • Non Tinker's books might need to be updated to work with this

Still TODOs

  • Fix ContentListings overflowing
  • Compress the .png's
  • Remove unnecessary HTML?? (like newlines)
  • Add back the previous page layout for old versions
  • Fix issues on mobile
  • Rebase before we merge

paypur added 14 commits July 3, 2025 14:54
Cleaned up scss

Took 3 hours 22 minutes
Took 4 minutes
Took 2 hours 15 minutes
Took 55 minutes
Took 1 hour 2 minutes
Fixed page-material padding incorrectly applying to the title

Took 10 minutes
Took 2 hours 27 minutes
Took 15 minutes
@KnightMiner
Copy link
Copy Markdown
Member

KnightMiner commented Jul 16, 2025

Something important to note: I don't want to replace the existing picture based books with HTML ones. I would rather have both. The reason is the image ones are way more likely to be stable on the chance the HTML updater breaks in the future, and are way more likely to be accurate across devices.

You will likely want a separate home page for HTML books vs image books, with links between the two as relevant.

@paypur
Copy link
Copy Markdown
Author

paypur commented Jul 17, 2025

Would it be better for the HTML books to be the primary, and the image books to be the fallback in case of any issues?

@KnightMiner
Copy link
Copy Markdown
Member

Neither is really primary or fallback. They are just different pages. The book index can link them both:

Icon
Title
HTML / Images

Key thing is I want to have both. I find images works very nicely on mobile notably.

paypur added 3 commits July 16, 2025 19:46
Took 59 minutes
Took 5 minutes
Took 1 hour 9 minutes
paypur added 2 commits July 17, 2025 15:43
Took 31 minutes
Took 11 minutes


Took 7 minutes
@paypur paypur changed the title Replace 1.20.1 Tinkers book images with auto generated HTML pages Add auto generated HTML pages Jul 18, 2025
Comment thread assets/css/slimeknights.scss Outdated
margin-top: 0.25em;
}

.spacing {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of spacing? Name is a little generic for how specific of a number it provides.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was just easier to change the css than a style when figure out how much padding I needed

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, if its worth keeping name it something like book-spacing. If its no longer needed then lets clean it up.

tbh, anything that common shows up is probably worth a class over a style as that allows us to fix it without regenerating all the files.

Comment thread assets/images/book/tinkers/arrows/fantastic_foundry/back.png
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can probably be replaced with CSS that just makes a 16x16 bit of padding. Though low priority to swap out.

Comment thread _includes/book/pages-html.html Outdated
{%- endcapture -%}
<div class="uk-width uk-margin mc-font-black book-page-html">
<img src="{{pagePath}}" alt=""/>
{% include book/{{include.book.path}}/page_{{pageIndex}}.html %}
Copy link
Copy Markdown
Member

@KnightMiner KnightMiner Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason for the weird book paths is meant as a sort of cache buster for images. However, on the HTML pages that is not needed as those are not cached in the same way (if they are cached, doesn't matter where you fetch this from).

I guess the hard part is we don't really have another string to suggest the location to fetch these from. I'm inclined to say add a second string like include.book.html since that will save effort updating books in the future. The HTML can then just be stored under _book/tinkers/1.20/encyclopedia and alike. The _ before book ensures Jekyll doesn't generate pages for each html file, since they will not be usable directly.

Comment thread _layouts/home.html
Comment thread assets/js/slimeknights.js
Comment thread docs/books/1.20/_index.md Outdated
Comment thread assets/js/book-html.js Outdated
Took 1 hour 2 minutes
Took 30 minutes
Took 12 minutes
Comment thread _layouts/book-html.html Outdated
Comment thread _layouts/book-html.html Outdated
Comment thread assets/css/book-html.scss
}

.content-list-links {
> div {
Copy link
Copy Markdown
Member

@KnightMiner KnightMiner Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file needs to be scss to use sassy css features. Jekyll will compile that to CSS so you still reference it as .css elsewhere.

Copy link
Copy Markdown
Author

@paypur paypur Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what scss features does it use? looks like plain css to me

Comment thread _sass/minetip.scss
@@ -0,0 +1,183 @@
/** from https://minecraft.wiki/w/MediaWiki:common.css */
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put this file in _sass and just include it in slimeknights.scss, like we do with treeview.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should also change the extension to scss as I believe its using scss features.

Comment thread _includes/book/pages.html Outdated
Comment thread _includes/book/link.html Outdated
Comment thread assets/css/slimeknights.scss Outdated
@KnightMiner KnightMiner changed the base branch from master to html-book April 18, 2026 22:16
@KnightMiner KnightMiner merged commit 5e3211d into SlimeKnights:html-book Apr 18, 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