feat(sidebar): add gitlab snippet and github gist export

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
Erik Michelson 2024-03-23 00:35:00 +01:00
parent 5fd8c02637
commit 0db5a0856b
13 changed files with 624 additions and 33 deletions

View file

@ -0,0 +1,19 @@
/*
* SPDX-FileCopyrightText: 2024 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { useMemo } from 'react'
import { useNoteTitle } from './use-note-title'
import sanitize from 'sanitize-filename'
/**
* Returns a sanitized filename for the current note based on the title.
* When no title is provided, the filename will be "untitled".
*
* @return The sanitized filename
*/
export const useNoteFilename = (): string => {
const title = useNoteTitle()
return useMemo(() => `${sanitize(title)}.md`, [title])
}