dmsnell / blocky-formats

Use the WordPress Block Editor to edit other structural formats.
1 stars 0 forks source link

Code blocks are properly parsed using bgrgicak/playground-blog #4

Open juanmaguitar opened 3 weeks ago

juanmaguitar commented 3 weeks ago

I created a custom repo based on bgrgicak/playground-blog proof of concept. My repo is available at wordpress-juanmaguitar/playground-blog

in that repo I created a few markdown posts, under the posts folder, using code blocks and inline code texts

This is the link for the playground for that repo: https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/wordpress-juanmaguitar/playground-blog/main/blueprint.json

Code blocks were not properly parsed as it can be seen in the following screenshot:

Screenshot 2024-06-13 at 16 21 26

cc: @bgrgicak @adamziel

dmsnell commented 3 weeks ago

thanks for the report @juanmaguitar! this isn't a problem with Markdown parsing, I don't believe, but rather a problem in Block printing to Markdown.

https://github.com/dmsnell/blocky-formats/blob/f9af13ab7995e2c0a1d1fd3f3c7167032baf958c/src/markdown.js#L106-L109

When this was quickly built I didn't cross all the t's and dot all the i's. You could fix this and enhance support by Markdown-escaping the output of the code block in the above-linked lines.

dmsnell commented 3 days ago

@juanmaguitar I tried to reproduce this just now and the code block is showing up as I expected it. I took the raw content from the ssh-in-github.md file and then clicked on "Import from Markdown" in the block-formats sidebar. It displayed as a code block with pre-formatted whitespace.

Am I doing something different than you did?

dmsnell commented 3 days ago

@juanmaguitar is it possible you attempted to load the posts as markdown? my plugin isn't setup to load the markdown and convert it. that's found in the Edit Visually browser extension