Repository navigation
Markdown and Books
Multi-line Markdown text, books and syntax highlighting.
new Markdown(text)
.onLink(url -> ...) // link click
.onTaskToggle((item, done) -> ...); // click on a "- [ ]" task
Markdown.bound(signal); // text from a signalSupported:
-
#headings and underlined headings; -
**bold**,*italic*,~~strikethrough~~,++underline++,==highlight==,`code`; - code blocks, quotes;
- nested bulleted and numbered lists, tasks;
- tables with alignment;
- links and autolinks;
- horizontal rules, escaping;
- icons
and; - syntax highlighting for code blocks with a language: java, json, css, html and more (see "Data, forms and books").
Text wraps to the width. Parsing happens once when the text changes, layout when the width changes. Colors come from the theme style.
Markdown split into pages: a break is a <!-- page --> or \newpage line; whatever doesn't fit flows to the next
page by itself (long paragraphs are split by words).
new Book(text); // like a Minecraft book: texture, "Page 1 of 5", arrows
new Book(text).look(Book.Look.MODERN).tableOfContents(true) // a spread on a theme card + table of contents as page one
.width(Dim.px(340)).height(Dim.px(220));
book.page().set(4); book.next(); book.previous(); book.goTo(0); book.pageCount(); book.toc();Pages turn with the arrows, the wheel, ←/→, PageUp/PageDown, Home/End, with a page flip animation and the
item.book.page_turn sound (sound(false), flipDuration(0.3f)). The table of contents is built from # and ##
headings (tocLevel(3)), and its entries are links. Links [text](#page:5) and [text](#chapter-name) turn the
book, the rest go to onLink. spread(false) is a single-page modern book. Styles: book and book.vanilla.
Code blocks with a language in Markdown and Book are highlighted: java, kotlin, javascript/js/ts,
json, css, html/xml/svg. Parsing happens once at layout; multi-line comments and text blocks are handled.
Colors adapt to the theme (light or dark text, accent for keywords); set your own with theme tokens:
theme.set(SyntaxHighlighter.STRING_COLOR, 0xFF98C379).set(SyntaxHighlighter.KEYWORD_COLOR, 0xFFC678DD);
SyntaxHighlighter.register((line, state, out) -> { out.span(0, line.length(), SyntaxHighlighter.COMMENT); return 0; },
"mylang"); // your own language: marks up a line, returns the state
SyntaxHighlighter.highlight("java", code); // line pieces with token kindsAn example of this whole section is the showcase page DataToolsPage.
← Forms · English home · Inventory and Slots →
Начало работы: Установка · Первый экран
Основы: Раскладка · Стили и темы · Цвета и градиенты · Анимации · Данные и сигналы · События и ввод
Виджеты: Каталог виджетов · Всплывающие окна · Формы · Markdown и книги
Игра: Инвентарь и слоты · Окна-контейнеры · Мобы, предметы и 3D · HUD · Карты
Оформление: Эффекты · Размытие, обрезка и GIF
HTML и CSS: HTML и CSS
Возможности: Языки · Экран настроек · Доступность и звуки
Для продвинутых: Расширение · Отладка и советы · Архитектура
Getting started: Installation · Your First Screen
Basics: Layout · Styles and Themes · Colors and Gradients · Animations · Data and Signals · Events and Input
Widgets: Widget Catalog · Popups · Forms · Markdown and Books
Game: Inventory and Slots · Container Screens · Mobs, Items and 3D · HUD Overlay · Maps
Visuals: Effects · Blur, Clipping and GIF
HTML and CSS: HTML and CSS
Features: Languages · Config Screen · Accessibility and Sounds
Advanced: Extending · Debugging and Tips · Architecture