Skip to content

Add Copy markdown to copy citation #13387

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

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

tushar-2320
Copy link

@tushar-2320 tushar-2320 commented Jun 21, 2025

Closes #12552
This pr contains the changes by adding the Markdown citation copy in the preview panel.I have added changes StandardAction.java ,RightClickMenu.java,CitationStyleOutputFormat.java,ClipboardContentGenerator.java by adding Markdown format and their style respectively.

Mandatory checks

  • I own the copyright of the code submitted and I license it under the MIT license
  • Change in CHANGELOG.md described in a way that is understandable for the average user (if change is visible to the user)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (if change is visible to the user)
  • Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

@tushar-2320
Copy link
Author

hey ,can you just guide If I am in the right direction or not.

@calixtus calixtus marked this pull request as draft June 21, 2025 14:02
@calixtus
Copy link
Member

You could start by fixing your PR description.

@tushar-2320
Copy link
Author

I have made the changes but not able find the fault as I can't see the effect in ui
can anyone review and guide me through this.

@koppor
Copy link
Member

koppor commented Jun 22, 2025

I have made the changes but not able find the fault as I can't see the effect in ui

  • fault of the test? -> Ignore that one (its an online download thing and the server is unreliable)
  • GUI effect -> you should be able to see your changes.

can anyone review and guide me through this.

Please add a CHANGELOG.md entry.

@koppor
Copy link
Member

koppor commented Jun 22, 2025

Tried out, UI works...

image

Update The content is a bit strange. I checked the code - it seems, citeproc.java is not used correctly?

\[1\]L\. Wegmeth\, T\. Vente\, and J\. Beel\, “Recommender Systems Algorithm Selection for Ranking Prediction on Implicit Feedback Datasets\,” in *Proceedings of the 18th ACM Conference on Recommender Systems*\, in RecSys ’24\. New York\, NY\, USA\: Association for Computing Machinery\, Oct\. 2024\, pp\. 1163–1167\. doi\: 10\.1145\/3640457\.3691718\.<br />

Copy link
Member

@koppor koppor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After a deeper look, I did not see any wiring in the library https://github.com/michel-kraemer/citeproc-java. Please do so.

@@ -5,7 +5,8 @@
public enum CitationStyleOutputFormat {

HTML("html", OS.NEWLINE + "<br>" + OS.NEWLINE),
TEXT("text", "");
TEXT("text", ""),
MARKDOWN("markdown", OS.NEWLINE + "<br>" + OS.NEWLINE);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<br> is not a good line separator in markdown. Just remove it. Two empty lines are ok.

@@ -120,6 +121,13 @@ static ClipboardContent processHtml(List<String> citations) {
return content;
}

static ClipboardContent processMarkdown(List<String> citations) {
String result = String.join(CitationStyleOutputFormat.MARKDOWN.getLineSeparator(), citations);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the convertion to Markdown made?

I think, you need to deal with setOutputFormat somehow michel-kraemer/citeproc-java@66cad6b

Comment on lines 191 to 192
requires flexmark;
requires flexmark.util.ast;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate module requirements detected. The 'flexmark' and 'flexmark.util.ast' modules are already declared earlier in the file, leading to redundant declarations that should be removed.

@tushar-2320 tushar-2320 requested a review from koppor June 24, 2025 12:08
Copy link
Member

@koppor koppor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a test so that one "sees" a conversion result in the code.

Comment on lines +125 to +128
/**
* Insert each citation into HTML.
* convert HTML to markdown using flexmark.
*/
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment is trivial and simply restates what the code does without providing additional information about the reasoning or important details about the implementation.

@jabref-machine
Copy link
Collaborator

JUnit tests of jablib are failing. You can see which checks are failing by locating the box "Some checks were not successful" on the pull request page. To see the test output, locate "Tests / Unit tests (pull_request)" and click on it.

You can then run these tests in IntelliJ to reproduce the failing tests locally. We offer a quick test running howto in the section Final build system checks in our setup guide.

@calixtus calixtus changed the title Draft:fix:Added copy Markdown to copy citation #12552. Add Copy markdown to copy citation Jun 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add markdown as copy format
5 participants