RhetTbull / macnotesapp

Work with Apple MacOS Notes.app from the command line. Also includes python interface for scripting Notes.app from your own python code.
MIT License
129 stars 6 forks source link

Markdown removes '@' at symbol #30

Closed TonyBarganski closed 1 year ago

TonyBarganski commented 1 year ago

I have text of format:

## Booking email:
1. [tony@somewhere.com](tony\@somewhere.com)
2. [tony@somewhere.com](mailto:tony\@somewhere.com)
3. [tony@somewhere.com](href="tony\@somewhere.com")
4. [tony@somewhere.com](href="tony@somewhere.com")
5. [tony@somewhere.com]
6. [tony@somewhere.com]([ "tony@somewhere.com" ]
<tony@somewhere.com>)

The note in Apple notes comes out as:

Booking email:
1. [tony.com](applewebdata://0BE0724A-2D5D-4D5E-B402-87ACA4F1F0C0/tony.com)
2. [tony.com](mailto:tony.com)
3. [tony.com](applewebdata://0BE0724A-2D5D-4D5E-B402-87ACA4F1F0C0/href=%22tony.com%22)
4. [tony.com](applewebdata://0BE0724A-2D5D-4D5E-B402-87ACA4F1F0C0/href=%22tony.com%22)
5. [tony.com]
6. [tony.com](applewebdata://0BE0724A-2D5D-4D5E-B402-87ACA4F1F0C0/%5B%20%22tony.com%22%20%5D%3Ctony.com%3E)
RhetTbull commented 1 year ago

Yeah, definitely shouldn't happen. The conversion is done with markdown2. I'll look to see if this is something they're doing or macnotesapp is doing.

RhetTbull commented 1 year ago

Hmmm...latest version of markdown2 seems to work. See code on replit

import markdown2

md = """## Booking email:
1. [tony@somewhere.com](tony\@somewhere.com)
2. [tony@somewhere.com](mailto:tony\@somewhere.com)
3. [tony@somewhere.com](href="tony\@somewhere.com")
4. [tony@somewhere.com](href="tony@somewhere.com")
5. [tony@somewhere.com]
6. [tony@somewhere.com]([ "tony@somewhere.com" ]"""

print(markdown2.markdown(md))
<h2>Booking email:</h2>

<ol>
<li><a href="tony\@somewhere.com">tony@somewhere.com</a></li>
<li><a href="mailto:tony\@somewhere.com">tony@somewhere.com</a></li>
<li><a href="href=&quot;tony\@somewhere.com&quot;">tony@somewhere.com</a></li>
<li><a href="href=&quot;tony@somewhere.com&quot;">tony@somewhere.com</a></li>
<li>[tony@somewhere.com]</li>
<li>[tony@somewhere.com]([ "tony@somewhere.com" ]</li>
</ol>
TonyBarganski commented 1 year ago

Apologies, my bad! I found the issue.

I was piping my todo.txt tasks through a meta-character filter function which was removing the '@' symbol.