acf-markdown-field icon indicating copy to clipboard operation
acf-markdown-field copied to clipboard

How to correct output the markdown field?

Open stepanselyuk opened this issue 10 years ago • 3 comments

Hello, I've installed ACF and acf-markdown-field plugin, added the markdown field and see it on the edit page properly. I've put in the field a some markdown text, and on in the main editor added [acf field="markdown"], so I see the text on the page, but it is not processed, just markdown as plain text.

How to make output for the users properly?

stepanselyuk avatar Dec 26 '14 15:12 stepanselyuk

I tried to install the Markdown Extra plugin as suggested on http://support.advancedcustomfields.com/forums/topic/add-markdown-support-in-custom-fields/ but without success.

stepanselyuk avatar Dec 26 '14 17:12 stepanselyuk

Hello @stepanselyuk Thanks for trying out this plugin! This field is in a way just a fancy textarea that helps when you write markdown, preview, fullscreen and so on. To display the content as html on your frontend you will need to parse it with a markdown-parser (take a look at https://github.com/chjj/marked).

If you also want syntax-highlighting for code-blocks I can recommend https://highlightjs.org/

jensjns avatar Dec 27 '14 15:12 jensjns

Just to throw a different markdown parser into the mix, I'm using Parsedown (http://parsedown.org/) and passing the fields content to it before outputting it - parsing it in PHP instead of JS.

Also doing syntax highlighting with highlightjs as jensjns said.

graham73may avatar Apr 23 '17 14:04 graham73may