Skip to content
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

Escape underscores on template labels #529

Merged
merged 8 commits into from
Dec 6, 2023

Conversation

Rdornier
Copy link
Contributor

@Rdornier Rdornier commented Nov 10, 2023

Fix part of issue #486, related to

I didn't change much because I think the markdown reading need to be preserved (see PR #481 (comment)).

For each label added from a template (tags, channel name and key-values only ; image and dataset name are correctly handled), the underscore is escaped with a backslah replaceAll("_", "\\_"). This enables a correct display of the label in omero.figure and it is compatible with Figure-to-pdf.py (_ and \_ are identically interpretated in the script).

I've also integrated this feature in the PR #528.

@snoopycrimecop
Copy link
Member

Conflicting PR. Removed from build OMERO-plugins-push#311. See the console output for more details.
Possible conflicts:

--conflicts

@snoopycrimecop
Copy link
Member

snoopycrimecop commented Nov 16, 2023

Conflicting PR. Removed from build OMERO-plugins-push#312. See the console output for more details.
Possible conflicts:

--conflicts Conflict resolved in build OMERO-plugins-push#319. See the console output for more details.

@will-moore
Copy link
Member

@Rdornier can you now rebase or merge in the master branch to fix the merge conflicts here (now that #528 is merged)? thx

@Rdornier
Copy link
Contributor Author

Rdornier commented Dec 1, 2023

I have a question regarding the documentation in the "Tips". It is written that to make a text italic, you need to use one start *italic* but it is also working with underscores _italic_. Should we add the two options in the tips ?
And should we also inicate how to escape the underscores to not be interpreted as markdown formatting ?

@will-moore
Copy link
Member

Yes, tips improvements sounds good. 👍

@will-moore will-moore added this to the 6.1.0 milestone Dec 1, 2023
Copy link
Member

@will-moore will-moore left a comment

Choose a reason for hiding this comment

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

Tips look good and underscore escaping is working as expected.

@will-moore
Copy link
Member

I just had a final thought/question before I merge this...
I wonder if we only need to escape underscores if there are more than 1 in the label?
E.g. If my tag is dead_cell then this won't be understood as markdown.
But if I have KV pair as my_key: my_value then this would need to be escaped.

I'm undecided by this:

  • Pro: we don't clutter the labels unnecessarily. For most users without multiple underscores, this stays clean and simple.
  • Cons: This is slightly "magic" behaviour that may be hard to understand as it's not consistent. Also, if you want to add markdown to an existing Tag dead_cell then you'd have to manually add escaping to the existing underscores.

So, I'm happy to stick with the existing behaviour, but just thought I'd ask the question?

Also, I think once this is merged, we are close to getting all this work released as https://github.com/ome/omero-figure/milestone/16.
Just a couple of my PRs to get reviewed and merged...

We could consider #524 too (needs merge conflicts fixed).

@Rdornier
Copy link
Contributor Author

Rdornier commented Dec 5, 2023

I see your point...
Preferentially, I would keep the current implementation because it is quite simple and consistant. However, if you really see an issue with escaping all underscores, then I can implement the counting. We can also ask the question to @jburel

I'm also thinking about a different solution to use the markdown. By default, nothing is interpretated as markdown. If the user introduce md: at the beginning, then the label is markdown compatible.
I don't know if this solution could be good / feasible ; it just comes out of the mind. It will however introduce a major change and we should open a need issue / PR to discuss about it.

@will-moore
Copy link
Member

OK, agreed. 👍

@will-moore will-moore merged commit f489a75 into ome:master Dec 6, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants