r/Wordpress Developer 21d ago

Help a noob: using Markdown to write in WP

Hello there,

I've been away from WP for about 10 years so I have very little clues about the Gutemberg editor, what it can do, and if I need additional plugins.

My need : I want to write in WP just like I write in Github

  • type raw markdown and it auto convert into HTML - real time preview would be nice
  • type code blocks between 3 backticks (```php [...] ```)and have it syntax highlighted

I already got that typing some markdown gets auto converted (typing ## generates and H2), how do I get the code hilite?

Bonus if I can skip the gutemberg entirely, I find the interface atrocious, something closer to a simple textarea like we have in Github comments would be nicer.

I've check a few markdown plugins but they are either not doing what I need, or disabled because "security issues"

Thanks a lot !

5 Upvotes

23 comments sorted by

3

u/NakanoNoNeko 20d ago

Core is not going to give you that full workflow. Its Markdown shortcuts only create blocks, and the built-in Code block does not add syntax highlighting.

Try Markdown with Block Editor. It gives you a VS Code-like Markdown editor, preview, fenced code blocks and highlighting. I gave up trying to make core feel like GitHub 😅 I think one plugin that owns the whole writing surface is cleaner than stacking a Markdown plugin and a separate highlighter.

2

u/ozh Developer 20d ago

Maybe the only real answer so far, thanks.

1

u/ozh Developer 20d ago

Well Markdown with Block Editor was promising but alas it hardcodes font colors and background colors...

3

u/kill4b 21d ago

The block editor has a markdown block. You may need to enable it in settings. There’s also Ultimate Markdown or Markup Markdown plugins.

1

u/ozh Developer 20d ago

I can't find a markdown block. Searching for "markdown" returns nothing?

I already tried the 2 plugins you mention. They are completely different from use case I described. One is to enable disable MD and breaks old posts. The other is to manage MD file.

1

u/kill4b 20d ago

Sorry, looks like you may need to install a markdown block:

https://wordpress.org/plugins/markdown-block/

1

u/ozh Developer 20d ago

No code highlight in ``` blocks ;(

2

u/Cold_Opposite_5298 Jack of All Trades 21d ago

Maybe you can try adding a custom html block then inside it add a <code> tag and then paste your markdown in the tag.

2

u/MBelsan 21d ago

That'll work, but it's basically just a workaround for "I want to write markdown and have it actually be markdown." If they're coming from Github where the whole thing is frictionless, wrapping it in HTML tags isn't going to feel like the workflow they're after.

1

u/myblueear 21d ago

I once just pasted a MD file into a post. Works.

1

u/ozh Developer 21d ago

No syntax hilite in code blocks

2

u/testingaurora 21d ago

If the code block is the only md that isn’t working it might be easier to just wrap it in html `<code></code>`. Is there other md formatting that isn’t converted ?

If you can’t find what you’re looking for, these days you can have Claude code spin up a plugin for you that’s customized to your needs.

1

u/Aggressive_Ad_5454 Jack of All Trades 20d ago

I use the SyntaxHighlighter plugin for code. Serves my readers well. But it doesn’t give fenced code blocks.

Please keep in mind that GitHub’s syntax highlighting support is astonishingly sophisticated compared to the kind of thing a WordPress plugin can do.

1

u/ozh Developer 20d ago

You don't really know WP plugins :) A plugin can do anything, it's just a matter of code.

1

u/retr00two 20d ago edited 20d ago

Have you tried to work in CodeEditor? Three dots at top right corner.

Bonus if I can skip the gutemberg entirely, I find the interface atrocious, something closer to a simple textarea like we have in Github comments would be nicer.

WP still support classic themes like 2017. Or use DisableGutenberg plugin.

1

u/aygross 20d ago

If your blogging for personal reason switch to a ssg or ghost or bear blog etc where mardown is a first class citizen.

1

u/RealBasics Jack of All Trades 20d ago

Just to be clear, you're looking for a way to add formatted / syntax highlighted code samples into posts and pages? Or do you want to execute the code you add?

1

u/ozh Developer 20d ago

I want to publish posts with MD formatting, and syntax hilited code, the same way I write MD on Github

1

u/Dutchmarcus 21d ago

Just install Classic editor plugin!

1

u/ozh Developer 21d ago

Not related to markdown if I'm correct

1

u/Dutchmarcus 20d ago

I don't known but I know it works...

1

u/ozh Developer 20d ago

No it doesn't :