risk-of-thunder / R2Wiki

156 stars 8 forks source link

Inconsistent markdown processing between github and wiki #22

Open LukeEff opened 1 year ago

LukeEff commented 1 year ago

I noticed in a recent PR I merged the markdown has not formatted as I expected in the wiki.Particularly, Most of the indented lists were not recognized by the live website.

Here's an example of the discrepancy. correct screen

And here's the code: https://github.com/risk-of-thunder/R2Wiki/blob/master/docs/Mod-Creation/C%23-Programming/Debugging-Your-Mods.md?plain=1#L165-L189

If this is working as intended, is there a syntax issue (such as improper spacing) that results in it not processing properly? Also, is there a markdown processing plugin that can be installed that better reflects the "live website"?

xiaoxiao921 commented 1 year ago

Yeah I had to fix it manually, this is most likely due to mkdocs having a different processor than the one used by ~mkdocs~ GitHub I'm afraid

LukeEff commented 1 year ago

You're right, I'm looking through the wiki right now.

mkdocs claims to use the Python Markdown library for translating the Markdown to html.

I have successfully replicated the issue by using their interpreter via a script i threw together:

import markdown

with open("docs/Mod-Creation/C#-Programming/Debugging-Your-Mods.md", "r", encoding="utf-8") as input_file:
    text = input_file.read()
    html = markdown.markdown(text)
    print(html)
LukeEff commented 1 year ago

https://github.com/Python-Markdown/markdown/issues/3#issuecomment-63399983

Must be 4 spaces for indentation to be registered for python-markdown, while Github's website uses an internal processor that allows a few as 2 spaces to count as an indentation.