ClassicPress/Directory

README.md styling issues

Closed this issue · 3 comments

There are several issues with README.md conversion in terms of styling. Using Update Manager as an example.

Issues

  1. Code blocks need to be displayed correctly using <pre> tags. Directory styles <code> blocks though.
    image

  2. Anchor links need to be removed or converted to directory's own anchor links.
    image

  3. Minor encoding issues.
    image

For reference, I found out GitHub has an API to render markdown to HTML. Not sure if it's usable for us:
https://docs.github.com/en/rest/markdown?apiVersion=2022-11-28

And this project provides stylesheets:
https://github.com/KrauseFx/markdown-to-html-github-style

Related to GitHub Markdown API, I ran a test and it seems to work. The API key required for authorization can be ClassyBot.

curl -X POST --data-binary @README.md  https://api.github.com/markdown/raw --header "Content-Type:text/x-markdown" --header "Authorization: Bearer XXXXXXXXXXXXXXXX" > a.html

If using API, the raw endpoint doesn't support GitHub Flavored Markdown. It only supports standard markdown.

Parsedown seems to be outdated. So if not the API, the other possible option to test is
https://github.com/michelf/php-markdown

Using Update Manager as an example, here's what the HTML code looks like converted using API. Much cleaner than parsedown.
a.html.txt