sstur / draft-js-export-markdown

DraftJS: Export ContentState to Markdown
http://npm.im/draft-js-export-markdown
55 stars 23 forks source link

Code blocks with multiple lines #15

Open robertlyall opened 8 years ago

robertlyall commented 8 years ago

Hey Simon,

Thanks for the library! I'm using stateToMarkdown on a project in conjunction with SamyPesse/draft-js-code which prevents new code blocks from being created when enter is pressed.

It's my understanding that the default behaviour in Draft is to create a new code-block, so this isn't a bug report by any means, however I was wondering whether you may be open to a pull request which would allow for code blocks with multiple new lines?

This hackery gave the desired output:

-this.output.push(CODE_INDENT + this.renderBlockContent(block).split('\n').join('\n' + CODE_INDENT) + '\n');

I noticed that in draft-js-export-html you've provided an API to define custom renderers, perhaps this is something I could try and provide you with some assistance with?