klikli-dev / modonomicon

Data-driven minecraft in-game documentation with progress visualization.
24 stars 10 forks source link

Indentations sometimes render when they should not #248

Closed DaFuqs closed 2 months ago

DaFuqs commented 2 months ago

Describe the bug When using bullet points and switching back to default text the intendations of the bullet points keeps applied.

image

This is the lang:

"- 1 Fusion Shrine\n- 4 Polished Gemstone Blocks\n- 4 Chiseled Polished Blocks\n- 8 Polished Pillars\n- 12 Polished Slabs\n- 77 Polished Blocks\n\nI'm able to switch [#](bb00bb)Basalt[#]() with [#](bb00bb)Calcite[#]() and choose the [Gemstone Blocks](entry://decoration/gemstone_storage_blocks) to my liking, as always."

Expected behavior The text that does not use bullet points anymore not rendering with intendation.

System (please complete the following information):

klikli-dev commented 2 months ago

@DaFuqs I am having trouble reproducing that, I get:

image

The only change I have is that I removed the link target and just use () (because I do not have that page). That is unlikely to "fix" this though.

Is your project on GitHub so I can try to reproduce it in place? I suspect the exact situation to reproduce it also needs the font and possibly other settings (Such as margins)

DaFuqs commented 2 months ago

Weird. Huh.

You can find my project here, yes: https://github.com/DaFuqs/Spectrum

klikli-dev commented 2 months ago

Thank you! Ok yeah that is super odd, because in your project the markdown parser already classifies the last paragraph as part of the bullet list, while on my end it does not.

This is weird because the markdown parser is completely independent from any modonomicon settings, and is unaware of minecraft, it just takes the text in the translation file. I need to investigate further

klikli-dev commented 2 months ago

@DaFuqs image

This fixes the issue. The \\ seems to cause markdown to interpret the texts to belong to the same paragraph or chunk or whatever. That is unintuitive but not something I can fix sadly (short of a PR to https://github.com/commonmark/commonmark-java, but I am not sure if that is not somehow intended behaviour under the markdown standard).

What remains a mystery is why it is not possible to have an empty line after the unordered list, I will investigate that further

EDIT: It seems that is also the parser's doing, seems to strip out anything inbetween, the document nodes are just the last unordered list item followed by the next text, no linebreaks or other inbetween

klikli-dev commented 2 months ago

@DaFuqs try the following:

In a java multiline string:

Unordered List:
- List item
- List item 2
- List item 3

\\
And now some other text.

Or as raw json: "Unordered List:\n- List item\n- List item 2\n- List item 3\n\n\\nAnd now some other text.\n"

The pattern \n\n\\\n seems to force the parser out of the list context AND insert a newline

klikli-dev commented 2 months ago

Closing this, while the behaviour is not optimal, it is consistent and can be controlled both in datagen and raw jsons

DaFuqs commented 2 months ago

That I can work with. Thank you very much for looking into this!