mammoth.js icon indicating copy to clipboard operation
mammoth.js copied to clipboard

Adding Support for linebreaks

Open Dravucz opened this issue 5 years ago • 1 comments

Hello I found it useful to add an options object for the extractRawText method with some flexibility. For our project we are trying to use the extractRawText function to include linebreaks as an option. image

My proposed changes are here: https://github.com/Dravucz/mammoth.js/pull/1 Heres a description:

Add option to include line breaks for the extractRawText method. Simply add an optional options object as a second argument with allowLineBreaks set to true and line breaks will get preserved. If options object is not included it will work as it originally did before. See attached screenshots for output with and without the option applied respectively image image

image image

Would this be possible?

I think this is relative

Current Setup: MEAN Stack Mongo, Express, Angular, Nodejs

  • Used with Node 8 in the backend part of our application

More information on what we do here: https://athennian.com/

Dravucz avatar Sep 17 '20 16:09 Dravucz

I created a PR for this issue here: https://github.com/mwilliamson/mammoth.js/pull/372 mimicking the changes @Dravucz had suggested but updated to for the refactoring that has been done. I also added a test and updated the readme.

ian-weir avatar Jul 06 '23 17:07 ian-weir