-
-
Notifications
You must be signed in to change notification settings - Fork 624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to parse HTML without removing newlines #807
Comments
True! You mean you have a
|
I have content that comes from a In that case, would it make sense to instead just skip over text within a |
Got it! Yes I think the goal for autotable should be to make it look like the HTML as closely as possible meaning linebreaks etc would not show up. I don't know how it handles |
A quick test shows that
multi\nline\ntext
multi
multi Using Vue.js, with
multi With
multi<br>line<br>text Within autotable, the newline characters are removed, so all of the above options result in "multilinetext" (no line break or space) being rendered into the document. An implementation of
This adds up to be a lot and as far as I know, autotable has no way of knowing whether content was injected or not. That combined with the assumption that most users will prefer their multiline text in the document's font rather than mono, makes it seem counterproductive to actually implement This does seem to be blown out of proportion just for the idea of removing a small redundancy, so I'd like to clarify it a little bit. At its core, the issue is that currently, to get line breaks with dynamic content, |
Sounds reasonable to me as well. The main question then is if this is best to add a new option for this or if it is enough to handle this case manually with |
I'm having something of the same issue but I'm not sure I'm getting there the same way as @ga-jrich. Inside a
Replacing the newline \n with Since the original issue doesn't seem to be using this method, did I overcomplicate things? Is there a solution that would work better for my use case? |
I have a table where every other row is user-input that comes from a textarea, meaning the lines are separated using
\n
rather than<br>
. I see below that you are stripping\n
but replacing<br>
with\n
afterwards.jsPDF-AutoTable/src/htmlParser.ts
Lines 92 to 100 in 30d4138
I understand the reasoning behind this decision, but it would be nice to have the option to preserve the original line breaks. As it stands, I have to replace
\n
in my text with<br>
only for it to be swapped back under the hood.The text was updated successfully, but these errors were encountered: