-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Enable proper pasting of HTML code into fields (by converting to Markdown) #10558
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
Comments
Hello, I'm an undergraduate programming major that's eager to make my first GitHub contribution. Would I be able to claim this issue? Thanks! |
Some more illustrations: https://www.markdownguide.org/basic-syntax/#unordered-lists |
As a general advice for newcomers: check out Contributing for a start. Also, guidelines for setting up a local workspace is worth having a look at. Feel free to ask here at GitHub, if you have any issue related questions. If you have questions about how to setup your workspace use JabRef's Gitter chat. Try to open a (draft) pull-request early on, so that people can see you are working on the issue and so that they can see the direction the pull request is heading towards. This way, you will likely receive valuable feedback. |
Thank you @ThiloteE and @koppor, I followed all the steps from guidelines for setting up a local workspace and successfully got everything set up and running in IntelliJ. I'll start working on the issue soon. |
I followed your instructions and I can clearly see the issue. My plan to fix this would be to add a method to JabRef that parses html and convert it to markdown. Per your included stack overflow hint, the FlexmarkHtmlConverter class lets us do this easily in only one line of code. In order to parse the text being pasted into the "Abstract" GUI text box, I'd need to find where that text is stored in the source code (i.e. what variable stores the text). From there I imagine performing a manipulation on that variable with the FlexmarkHtmlConverter class would be fairly simple. Would this adequately resolve the issue? Please let me know if my plan is on the right track, and if so, even a little hint as to where I can find the code for the text boxes would be very much appreciated. Thanks! |
@DavidCoy77 Development involves code reading and understanding. That takes time. You can search for an arbitrary string in the code using Ctrl+Shift+F. Maybe that helps to locate some code. I searched around the code a bit, found Just try. We do not know the solution yet. You are the one searching for the solution. |
I'll keep plugging away! |
I've spent time brainstorming and taking notes, but I haven't changed any code yet, so I ran the Are these failed tests anything I need to worry about for the scope of this issue? Is there a mistake I made in the setup process that caused those tests to fail? Thanks! |
Regarding the failed tests, we started to work on that at #9992, but we failed. Note that you can execute all the tests in WSL2 - and they will be green. I don't have a good HowTo in mind, but https://youtrack.jetbrains.com/issue/IDEA-284123/Can-I-execute-JUnit-Test-using-IntelliJ-in-WSL2 should be of some guidance. You are invited to switch topics and try to fix (part of) the failing tests. There nearly aren't any UI tests. You can start understanding the existing entry editor ui tests and then think of how to add the feature tests there. Please don't let you get distracted by some locally failing tests. Our CI runs through. UI coding is hard. I would recommend to try to work with breakpoints to understand how JabRef / JavaFX works and then hook into the appropriate places. |
Ok sounds good, I just wanted to double check so thanks! |
Hi @koppor there is nothing to change in the code. You can copy the book description and paste it into Microsoft word then only you should copy and paste the same description in the Abstract section in jabref tool. |
Hi @koppor It appears that when extracting data from a browser and inputting it into JabRef's abstract field, bullet points are not preserved. To address this, you suggest an interim step of transferring the data to MS Word before copying it into JabRef. However, if formatting issues, such as the absence of bullet points, persist, consider adjusting the formatting in MS Word or exploring alternative formats, like Markdown, which JabRef supports more effectively. If you have specific issues or questions, feel free to provide more details for further assistance. |
Yes. See the steps at the issue description (first entry in this thread)
No, I do not. JabRef should "just" work. Please make JabRef handling HTML input properly. Maybe, there is a Java library able to convert HTML to Markdown. - Please start to use flexmark-html2md-converter. |
Hi @koppor, it looks like the flexmark-html2md library doesn't do what you originally thought. It's for converting snippets like this to HTML:
not this:
Do you have any suggestions as to where to go from here? We haven't been able to find an existing library for interpreting the second snippet as markdown. I suspect that programs like MS Word use their own custom parsers. |
@brennanmcmicking Please state the source of your claim. Maybe a minimal Java project. I checked the source code of |
@koppor Yes, I agree.
My claim is that Flexmark's HTML2MD converter is of no use to us in this context. |
Wait nevermind, hooking into the |
Hi @koppor, you may assign this issue to me :). I have a PR for this fix and am currently waiting for it's checks to pass before making it ready for review. |
Actual result:
This is "OK", but the bullet list should be formatted with
*
:Expected result:
Some background information:
Note that a paste into Microsoft Word keeps the bullet list:
That means that the clipboard contains the "correctly" formatted content.
Implementation hint:
The text was updated successfully, but these errors were encountered: