acf-markdown-field
acf-markdown-field copied to clipboard
How to correct output the markdown field?
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?
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.
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/
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.