hedgedoc icon indicating copy to clipboard operation
hedgedoc copied to clipboard

heading level >1 doesn't set the note title

Open hferreiro opened this issue 4 years ago • 4 comments

Description

If the note doesn't have a level 1 heading, the title should be set by taking the first heading, whatever the level. Additionally, if a level >1 heading appears before a level 1 heading, the title should probably be taken from the former.

Steps to reproduce

Use ## test as the note content.

Expected behaviour

The note should have "test" as its title.

hferreiro avatar Dec 10 '21 10:12 hferreiro

I changed the label to "enhancement" because the behavior isn't an error. It works as intended. Anyway, the idea is still good.

But we won't change it in HedgeDoc 1. I'll move this ticket to the development repository of the new frontend for HedgeDoc 2.

mrdrogdrog avatar Dec 10 '21 10:12 mrdrogdrog

The relevant code snippet can be found here: https://github.com/hedgedoc/react-client/blob/HEAD/src/components/markdown-renderer/hooks/use-extract-first-headline.ts#L42

ErikMichelson avatar Dec 10 '21 10:12 ErikMichelson

do we have any places in the backend that would need to generate a title? an api-endpoint perhaps? Because frontend and backend should behave the same for any given document.

ccoenen avatar Dec 10 '21 13:12 ccoenen

The plan is that the Backend uses code from the Frontend code base for this. So it needs to be implemented only once.

mrdrogdrog avatar Dec 10 '21 13:12 mrdrogdrog

This was already fixed

DerMolly avatar Sep 01 '24 10:09 DerMolly