gsantner / markor

Text editor - Notes & ToDo (for Android) - Markdown, todo.txt, plaintext, math, ..
https://github.com/gsantner/markor/discussions/2269
Other
3.75k stars 359 forks source link

ShareInto: Pipe ("|") in text association breaks GitHub Markdown for links #2308

Closed RalphHightower closed 2 months ago

RalphHightower commented 4 months ago

⚠️ This issue respects the following points: ⚠️

Description

The pipe in the descriptive text for links where the site name becomes part of the description breaks the GitHub Markdown for lins. Example of what would be from LiveScience: ArticleTitle / LiveScience. In the additional info/logs, I included a table that compares 2.12.2 to 2.11.0. V2.12.2 looks fine in Markor, but it breaks when uploaded to GitHub.

Steps to reproduce

  1. Google Chrome: goto https://www.livescience.com/stonehenge-england-ancient-history
  2. Click on the three horizontal dots on the top roght
  3. Copy the date "October 9, 2023" to the clipboard.
  4. Select "Share"
  5. Choose "Markor"
  6. Enter newline after the link for a blank line
  7. Paste the date on the blank line
  8. Copy to QuickLinks

Information

Android version: 14 (5.10.198-android12-9-28575149-abS908USQS5EXE2 #1 SMP PREEMPT Fri May 10 18:42:43 UTC 2024) Device: Samsung Galaxy S22 Ultra (samsung SM-S908U) App Version: v2.12.2

Source

Google Play

Format / File type

Markdown

Additional info / Log

I format the markdowns to add to tables. Below is a comparison of Markor versions. Table comparisons is on [RalphHightower/JekyllTestBed: Test Bed for Experimentation with Jekyll](https://github.com/RalphHightower/JekyllTestBed)

## Test to see if "|" inside text of link breaks the link.

| markor version | test | date |
|---|---|---|
| [Markor v2.11.0 (147\)](https://github.com/gsantner/markor/releases/tag/v2.11.0)[^21]  | [Where is Stonehenge, who built the prehistoric monument, and how? / Live Science](https://www.livescience.com/stonehenge-england-ancient-history) | October 9, 2023[^41] |
| [Markor v2.12.2 (code 151\)](https://github.com/gsantner/markor/releases/tag/v2.12.2)[^22] | [Where is Stonehenge, who built the prehistoric monument, and how? | Live Science](https://www.livescience.com/stonehenge-england-ancient-history) | October 9, 2023[^42] |

[^21]: \[Where is Stonehenge, who built the prehistoric monument, and how? / Live Science](https://www.livescience.com/stonehenge-england-ancient-history) \| October 9, 2023 \|<br />[Markor v2.11.0 (147\)](https://github.com/gsantner/markor/releases/tag/v2.11.0)

[^22]: \[Where is Stonehenge, who built the prehistoric monument, and how? \| Live Science](https://www.livescience.com/stonehenge-england-ancient-history) \| October 9, 2023 \|<br />[Markor v2.12.2 (code 151\)](https://github.com/gsantner/markor/releases/tag/v2.12.2)

[^41]: Success
[^42]: Failure
harshad1 commented 4 months ago

What is the desired behaviour here? Is there a standard for how to format link text?

Is this something that should be a filed as a bug against github?

RalphHightower commented 4 months ago

Prior to v2.12, Markor put a slash in between the text of the link that separates it from the Site name. V2.12 changed the separation character to a pipe, which wrecks havoc with forming properly formatted links. I added a screenshot of the web page that I'm experimenting with. I can work around how v2.12 and v2.11 differ by changing the pipe to a slash before incorporating the links before use.

Screenshot_20240526_231325_Chrome

harshad1 commented 4 months ago

Ok. I see where this used to be

https://github.com/gsantner/markor/blob/v2.11.0/app/src/main/java/net/gsantner/markor/activity/DocumentShareIntoFragment.java#L421

I'll fix it soon.

RalphHightower commented 4 months ago

Thank you.

harshad1 commented 4 months ago

Is escaping the pipe sufficient? I.e. \|

RalphHightower commented 4 months ago

That works; past precedence used /. Whichever way is best for the project.

RalphHightower commented 4 months ago

A potential "gotcha". For this particular link, https://www.colorado.edu/today/2024/04/29/new-star-about-appear-night-sky-heres-how-catch-glimpse, Markor outputs the descriptive text with two pipes.

2024-05-31: I changed the above from two links to two pipes.

| A new star is about to appear in the night sky. Here’s how to catch a glimpse | CU Boulder Today | University of Colorado Boulder | April 29, 2024 |

harshad1 commented 4 months ago

This is now fixed in #2307

harshad1 commented 4 months ago

For reference. The pipe does not break links. It breaks table formatting in links. I am not sure if the 'fix' of replacing pipes with a slash is the right thing to do here.

Leaving this fix in as it was the historical behavior

gsantner commented 4 months ago

Replacing pipe with slash and that in reformatted links only - sounds good. Having escaped pipe looks worse to me