-
Notifications
You must be signed in to change notification settings - Fork 81
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
Add option to new-note-namer, to underline the heading instead of highlighting it with # #249
Conversation
…g it with a preceding hashtag
if (underlineHeading){ | ||
return newName + "\n========================" | ||
} else { | ||
return "# " + newName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please adapt the amount of whitespace?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed my portion of the code. The original script is not properly consistent with its use of whitespace in the first place. Please let me know if I shall unify the whitespacing throughout the whole script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The whole script is a mess, you are right. Please do so in another PR.
new-note-namer/new-note-namer.qml
Outdated
@@ -41,7 +49,11 @@ QtObject { | |||
script.log(note.fileCreated) | |||
script.log(note.fileLastModified) | |||
|
|||
return "# " + newName; | |||
if (underlineHeading){ | |||
return newName + "\n========================" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't you rather want to count how many =
you need according to the name
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a great idea. The updated file contains that feature.
new-note-namer/info.json
Outdated
@@ -2,9 +2,9 @@ | |||
"name": "New note namer", | |||
"identifier": "new-note-namer", | |||
"script": "new-note-namer.qml", | |||
"authors": ["@diegovskytl"], | |||
"authors": ["@diegovskytl,@Mystechry"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use "
for strings, and add a space before the string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
new-note-namer/new-note-namer.qml
Outdated
@@ -41,7 +49,11 @@ QtObject { | |||
script.log(note.fileCreated) | |||
script.log(note.fileLastModified) | |||
|
|||
return "# " + newName; | |||
if (underlineHeading){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a space, like ) {
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
1. Count heading length and adapt the number of '=' characters used for underlining the heading 2. Fixed bug where the first 2 characters were cut from the file name when using '=' to highlight the heading 3. Unified some whitespaces
Let me know if there are any further issues or suggestions. |
Thank you! |
The script
new-note-namer
deviates from how QOwnNotes highlights the automatically created heading. Instead of underlining the first line with======
, it precedes it with#
.I prefer the way how QOwnNotes highlights the first line, so I added a checkbox to
new-note-namer
's settings that restores the default behavior.I have done some testing and did not notice any regression. Please let me know, if anything looks suspicious.
I do not have any particular preference for which heading style shall be used as the default. I suggest to default to my style and underline the first line with
=====
, so that it matches QOwnNotes default aesthetics. However, I do not have a strong opinion on this and respect the author's preference to default to#
, so I use that for default. Feel free, to reject the PR, if I shall use=====
as default.