Open alianza opened 1 year ago
Will there ever be support on this, I still don't have this working and it is pretty standard behavior which I'm trying to achieve. Also this is a use-case documented in the documentation but it's not working properly!
this is open-source project. You're welcome to contribute. Pretty standard should also be to describe an issue in a way, that can easily be reproduced 😉
I copied config.yml and public/admin/index.html files from mentioned repo, to recreate the issue. My preview pane is rendered. I also cloned repo and tried on it, result is the same
Later I figured out that instructions to recreate issue are errorneous, since code already includes workaround marked.parse()
. Removing that part of code lead me to the screen with issue, where I can finaly confirm to see it.
Proper screenshot for an issue would look like this (without some panel hiding preview pane)
Writing down details of my research, to help the one that will try next time
Describe the bug
Custom editor components registered with
CMS.registerEditorComponent()
don't render their markdown content in the preview window. So if you use the markdown plugin in a custom editor component it just displays the raw markdown in the preview window. E.g. the example<details/>
tag custom editor component from the documentation ofregisterEditorComponent
(https://decapcms.org/docs/custom-widgets/#registereditorcomponent), after you fix thedetails
variable names that are wrong -> https://github.com/decaporg/decap-website/issues/13. The widget works but markdown content is not rendered, see screenshot below.The rest of the page renders all markdown fine. Repo: https://github.com/alianza/portfolio-v2
A working fix but not ideal because of increased initial loading times is to load a library like
marked
(could not findremark
cdn equivalent) via cdn and returnmarked.parse(markdownContent)
in thetoPreview()
method of the custom editor component. Then it renders correctly in the preview window!A nicer solution would be if this would just work out of the box, or if we could use the
remark
markdown parser used by the CMS internally to render markdown content so we don't have to load a 3rd party library for that on the side.To Reproduce Steps to reproduce the behavior:
npm install
local_backend
to true inpublic/admin/config.yml
npm run dev
http://localhost:3000/admin/index.html
Expected behavior Markdown content is rendered in preview pane
Screenshots
Applicable Versions: netlify-cms-app 2.15.72 netlify-cms-core 2.55.2 netlify-cms 2.10.192
CMS configuration