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

first line should be style "title" (& markdown is ignored) #13

Open
dmd opened this issue Nov 6, 2022 · 4 comments
Open

first line should be style "title" (& markdown is ignored) #13

dmd opened this issue Nov 6, 2022 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@dmd
Copy link

dmd commented Nov 6, 2022

If I add a note using notes -e:

  • Actual behavior
    • the first line is styled as Helvetica, Regular, 12
    • subsequent lines are styled as System Font (Default), Regular, 13
  • Expected behavior
    • The first line is styled using Notes' "Title" style, which is System Font (Default), Bold, 20

If I add a note using notes -e -m:

  • Actual behavior
    • the first line is styled as Helvetica, Regular, 12
    • markdown is ignored on the first line; i.e., if you type # this is the first line the # shows up in Notes
    • subsequent lines are styled according to markdown rules
  • Expected behavior
    • EITHER the first line is styled using markdown rules OR using Notes' "Title" style - I'm not sure which is better. I would tend to expect the former but could see arguments for the latter since you're using that as the lookup key?
@RhetTbull
Copy link
Owner

Thanks -- I'll take a look. It's not possible to stylize the title via the Notes AppleScript interface so this is tricky to implement.

@RhetTbull RhetTbull added the bug Something isn't working label Nov 7, 2022
@RhetTbull
Copy link
Owner

I've been able to replicate this and did some testing via adding notes a number of different ways. If the name (title) of the note is blank, Notes sets the title to "Notes" which isn't helpful. Unfortunately, as annoying as this is, it may be something I can't fix as long as I'm stuck using the AppleScript interface to add notes. If I could find a private API that Apple uses and call that, I might be able to set the style for the title but at the moment, anything I try results in formatting being stripped from the title when added via AppleScript.

The first entry is the one created by Notes.app directly. The others were all created by macnotesapp.

[
    {
        "account": "iCloud",
        "id": "x-coredata://BA47E88C-3599-48BE-88DD-5CBC118E9CE6/ICNote/p1483",
        "name": "This is a brand new note",
        "body": "<div><h1>This is a brand new note</h1></div>\n<div><br></div>\n<div>This is body text.</div>\n",
        "creation_date": "2022-11-06T20:27:06",
        "modification_date": "2022-11-06T20:27:15",
        "password_protected": false,
        "folder": "Notes"
    },
    {
        "account": "iCloud",
        "id": "x-coredata://BA47E88C-3599-48BE-88DD-5CBC118E9CE6/ICNote/p1486",
        "name": "This is a brand new note added via `notes add -e -m`",
        "body": "<div><font face=\"Helvetica\">This is a brand new note added via `notes add -e -m`</font></div>\n<div><b><span style=\"font-size: 
24px\">This is markdown header 1</span></b></div>\n<div>This is some text</div>\n<div><b><span style=\"font-size: 18px\">This is a markdown header 
2</span></b></div>\n<div>This is more text</div>\n",
        "creation_date": "2022-11-06T20:32:13",
        "modification_date": "2022-11-06T20:32:13",
        "password_protected": false,
        "folder": "Notes"
    },
    {
        "account": "iCloud",
        "id": "x-coredata://BA47E88C-3599-48BE-88DD-5CBC118E9CE6/ICNote/p1487",
        "name": "This is a brand new note added via `notes add -e --html`",
        "body": "<div><font face=\"Helvetica\">This is a brand new note added via `notes add -e --html`</font></div>\n<div><b><span style=\"font-size: 
24px\">This is a heading</span></b></div>\n<div>This is a paragraph</div>\n<div>This is another paragraph</div>\n<div>This is a <b>bold</b> 
paragraph</div>\n",
        "creation_date": "2022-11-06T20:33:06",
        "modification_date": "2022-11-06T20:33:06",
        "password_protected": false,
        "folder": "Notes"
    },
    {
        "account": "iCloud",
        "id": "x-coredata://BA47E88C-3599-48BE-88DD-5CBC118E9CE6/ICNote/p1492",
        "name": "This is a brand new note added via `notes add -e --html` using same\u2026",
        "body": "<div><font face=\"Helvetica\">This is a brand new note added via `notes add -e --html` using same markup as 
Notes.app</font></div>\n<div><b><span style=\"font-size: 24px\">This is a brand new note added via `notes add -e --html` using same markup as 
Notes.app</span></b></div>\n<div>\\n</div>\n<div><br></div>\n<div>\\n</div>\n<div>This is body text.</div>\n<div>\\n&quot,</div>\n",
        "creation_date": "2022-11-06T20:44:57",
        "modification_date": "2022-11-06T20:44:57",
        "password_protected": false,
        "folder": "Notes"
    },
    {
        "account": "iCloud",
        "id": "x-coredata://BA47E88C-3599-48BE-88DD-5CBC118E9CE6/ICNote/p1488",
        "name": "<h1>This is a brand new note added via `notes add -e --html` but with\u2026",
        "body": "<div><font face=\"Helvetica\">&lth1&gtThis is a brand new note added via `notes add -e --html` but with header tags in the first 
line&lt/h1&gt</font></div>\n<div>This is some text</div>\n",
        "creation_date": "2022-11-06T20:34:15",
        "modification_date": "2022-11-06T20:34:15",
        "password_protected": false,
        "folder": "Notes"
    },
    {
        "account": "iCloud",
        "id": "x-coredata://BA47E88C-3599-48BE-88DD-5CBC118E9CE6/ICNote/p1485",
        "name": "This is a brand new note added via `notes add -e`",
        "body": "<div><font face=\"Helvetica\">This is a brand new note added via `notes add -e`</font></div>\n<div><br></div>\n<div>This is body 
text</div>\n",
        "creation_date": "2022-11-06T20:31:14",
        "modification_date": "2022-11-06T20:31:14",
        "password_protected": false,
        "folder": "Notes"
    }
]

@dmd
Copy link
Author

dmd commented Nov 7, 2022

I'd say submit this to https://feedbackassistant.apple.com/ but I have bugs of this caliber on there that are 8 years old that have never been looked at. I don't think anyone at Apple even knows it exists.

@RhetTbull RhetTbull self-assigned this Nov 8, 2022
@RhetTbull
Copy link
Owner

I'm in the midst of a complete rewrite of this project to use ScriptingBridge (#16) and I've figured out how to apply style to the title of the note. I've not quite figured out how to replicate the default style Notes.app but think I can eventually do this. The new rewrite will be much faster and will enable a fully-interactive UI in the Terminal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: In Progress
Development

No branches or pull requests

2 participants