@@ -21,8 +21,8 @@ import rehypeReact from 'rehype-react'
2121import CodeFence from '../components/atoms/markdown/CodeFence'
2222import { getGlobalCss , selectTheme } from './styled/styleUtil'
2323
24- const sanitizeNoteName = function ( rawNoteName : string ) : string {
25- return filenamify ( rawNoteName . toLowerCase ( ) . replace ( / \s + / g, '-' ) )
24+ const filenamifyNoteTitle = function ( noteTitle : string ) : string {
25+ return filenamify ( noteTitle . toLowerCase ( ) . replace ( / \s + / g, '-' ) )
2626}
2727
2828const getFrontMatter = ( note : NoteDoc ) : string => {
@@ -75,7 +75,7 @@ export const exportNoteAsHtmlFile = async (
7575
7676 downloadString (
7777 file . toString ( ) ,
78- `${ sanitizeNoteName ( note . title ) } .html` ,
78+ `${ filenamifyNoteTitle ( note . title ) } .html` ,
7979 'text/html'
8080 )
8181 return
@@ -102,7 +102,7 @@ export const exportNoteAsMarkdownFile = async (
102102 content += includeFrontMatter ? getFrontMatter ( note ) : ''
103103 downloadString (
104104 content ,
105- `${ sanitizeNoteName ( note . title ) } .md` ,
105+ `${ filenamifyNoteTitle ( note . title ) } .md` ,
106106 'text/markdown'
107107 )
108108 return
@@ -256,7 +256,7 @@ export const exportNoteAsPdfFile = async (
256256 note . tags . length > 0 ? `, tags: [${ note . tags . join ( ' ' ) } ]` : ''
257257 const headerFooter : Record < string , string > = {
258258 title : `${ note . title } ${ tagsStr } ` ,
259- url : `file://${ sanitizeNoteName ( note . title ) } .pdf` ,
259+ url : `file://${ filenamifyNoteTitle ( note . title ) } .pdf` ,
260260 }
261261 const printOpts = {
262262 // Needed for codemirorr themes (backgrounds)
@@ -272,7 +272,7 @@ export const exportNoteAsPdfFile = async (
272272 . then ( ( data ) => {
273273 if ( data ) {
274274 // We got the PDF - offer the user to save it
275- const pdfName = `${ sanitizeNoteName ( note . title ) } .pdf`
275+ const pdfName = `${ filenamifyNoteTitle ( note . title ) } .pdf`
276276 const pdfBlob = new Blob ( [ data ] , {
277277 type : 'application/pdf' , // application/octet-stream
278278 } )
0 commit comments