raylib: release notes are drawn with HTML renderer (#36245)

* stash

* ok chatter is useful for once

* draw text outside tags

* hmm

* undo that shit

* i don't like this chatgpt

* Revert "i don't like this chatgpt"

This reverts commit 5b511911d81242457bfb5fc808a9b9f35fe9f7a2.

* more robust parsing (works with missing tags, markdown.py actually had bug) + add indent level

* the html looks weird but is correct - the old parser didn't handle it

* clean up

* some

* move out

* clean up

* oh this was wrong

* draft

* rm that

* fix

* fix indentation for new driving model

* clean up

* some clean up

* more clean up

* more clean up

* and this

* cmt

* ok this is egregious mypy
This commit is contained in:
Shane Smiskol
2025-10-03 21:47:53 -07:00
committed by GitHub
parent bd9888a439
commit 2337704602
5 changed files with 55 additions and 61 deletions
+5 -3
View File
@@ -70,6 +70,7 @@ class HtmlRenderer(Widget):
ElementType.H5: {"size": 44, "weight": FontWeight.BOLD, "margin_top": 12, "margin_bottom": 6},
ElementType.H6: {"size": 40, "weight": FontWeight.BOLD, "margin_top": 10, "margin_bottom": 4},
ElementType.P: {"size": text_size.get(ElementType.P, 38), "weight": FontWeight.NORMAL, "margin_top": 8, "margin_bottom": 12},
ElementType.LI: {"size": 38, "weight": FontWeight.NORMAL, "color": rl.Color(40, 40, 40, 255), "margin_top": 6, "margin_bottom": 6},
ElementType.BR: {"size": 0, "weight": FontWeight.NORMAL, "margin_top": 0, "margin_bottom": 12},
}
@@ -122,9 +123,6 @@ class HtmlRenderer(Widget):
if tag == ElementType.BR:
self._add_element(ElementType.BR, "")
elif tag == ElementType.UL:
self._indent_level = self._indent_level + 1 if is_start_tag else max(0, self._indent_level - 1)
elif is_start_tag or is_end_tag:
# Always add content regardless of opening or closing tag
close_tag()
@@ -133,6 +131,10 @@ class HtmlRenderer(Widget):
if is_start_tag:
current_tag = tag
# increment after we add the content for the current tag
if tag == ElementType.UL:
self._indent_level = self._indent_level + 1 if is_start_tag else max(0, self._indent_level - 1)
else:
current_content.append(token)