WordPress / wporg-developer-blog

https://developer.wordpress.org/news/
11 stars 3 forks source link

Add temporary fix for code syntax highlighting. #61

Closed ndiego closed 6 months ago

ndiego commented 7 months ago

The Developer Blog uses the Code Syntax Block plugin to provide syntax highlighting to all Code blocks. This has worked great until recently, where new lines are replaced with <br> elements in the code. The plugin does not parse these <br> elements as actual line breaks, thinking they are part of the code, which results in the following:

Expected Actual
image image

As a temporary solution, this PR implements a filter for the Code block, replacing all <br> with \n.

ndiego commented 7 months ago

@ryelle if you have a chance today, can you review this PR? It's a temporary fix but an important one for the Blog, and we have a couple of articles set to be published this week that will need the fix so the code blocks appear correctly. Let me know if you have any questions/concerns 🙏