Closed drxcheng closed 3 years ago
Hey @drxcheng, there is no built-in function to do this, but you could configure the exporter for this yes.
This is very experimental but I made a Markdown exporter, which is based on draftjs_exporter, just redefining how elements are rendered to use Markdown syntax: https://github.com/thibaudcolas/draftjs_exporter_markdown. I wouldn’t suggest you use it as-is for anything serious, but it shows how you’d customize the exporter to output something that has less formatting.
But if you really want plain text without any markup – you don’t even need the exporter, just iterate through the blocks manually:
plain_text = ""
for block in content_state["blocks"]:
plain_text += f"{block["text"]}\n"
I hope that helps.
is there a built-in function to do it?
if not, is it possible to set configuration to do it?
thanks!