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

Support atx-style headers #272

Closed
minthemiddle opened this Issue Jul 30, 2016 · 7 comments

Comments

Projects
None yet
2 participants
@minthemiddle

minthemiddle commented Jul 30, 2016

Now that filename and note header can be different, it would be very convenient if QOwnNotes gave the option to use atx-style headers (#, ##, ...) instead of setext.

@pbek pbek added the enhancement label Jul 30, 2016

@pbek

This comment has been minimized.

Owner

pbek commented Jul 30, 2016

There already is a script for custom note headlines: https://github.com/pbek/QOwnNotes/blob/develop/doc/scripting/custom-new-note-headline.qml

Does that work for you?

@pbek pbek closed this Jul 30, 2016

@minthemiddle

This comment has been minimized.

minthemiddle commented Jul 30, 2016

Scripting seems the way to go, but unfortunately that does not work.

(1) Changing the script to my liking

    function handleNewNoteHeadlineHook() {
        var date = new Date();
        return "# " + date.toISOString();
    }
}

(2) Creating a new note
(3) Here is what you get

# 2016-07-30T14:22:06.412Z
==========================

The other problem I'm facing:

When I search for something that does not exist and create a note from there, this script is being ignored.

@pbek pbek reopened this Jul 30, 2016

@pbek

This comment has been minimized.

Owner

pbek commented Jul 30, 2016

I guess I will put that on my todo list.

@pbek

This comment has been minimized.

Owner

pbek commented Aug 1, 2016

16.08.0

  • the scripting hook handleNewNoteHeadlineHook() now has a parameter
    to pass the text that would be used to create the headline
    • the hook will now also be called when using the search line edit
    • if you are using the hook you have to add the parameter to the
      function in your script, so that the scripting engine will find
      your function call
    • if the headline text was modified by the hook no underline
      characters === will be added automatically, you have to do that
      in your script
    • take a look at the updated example at
      custom-new-note-headline.qml
    • you now can use the hook to create your own headline styles,
      for example using # headline instead of headline, followed by
      ==========
      • if you are doing this don't forget to allow the note
        headline to be different from the note filename in the
        general settings

@genvoa, be also aware of these changes

@pbek pbek added this to the 16.08.0 milestone Aug 1, 2016

@pbek

This comment has been minimized.

Owner

pbek commented Aug 1, 2016

There now is a new release, could you please test it and report if the new features work for you?

@minthemiddle

This comment has been minimized.

minthemiddle commented Aug 1, 2016

Yes, that works flawless now. Superb!

@pbek

This comment has been minimized.

Owner

pbek commented Aug 1, 2016

Great, thank you for testing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment