@@ -21,8 +21,8 @@ import rehypeReact from 'rehype-react'
21
21
import CodeFence from '../components/atoms/markdown/CodeFence'
22
22
import { getGlobalCss , selectTheme } from './styled/styleUtil'
23
23
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, '-' ) )
26
26
}
27
27
28
28
const getFrontMatter = ( note : NoteDoc ) : string => {
@@ -75,7 +75,7 @@ export const exportNoteAsHtmlFile = async (
75
75
76
76
downloadString (
77
77
file . toString ( ) ,
78
- `${ sanitizeNoteName ( note . title ) } .html` ,
78
+ `${ filenamifyNoteTitle ( note . title ) } .html` ,
79
79
'text/html'
80
80
)
81
81
return
@@ -102,7 +102,7 @@ export const exportNoteAsMarkdownFile = async (
102
102
content += includeFrontMatter ? getFrontMatter ( note ) : ''
103
103
downloadString (
104
104
content ,
105
- `${ sanitizeNoteName ( note . title ) } .md` ,
105
+ `${ filenamifyNoteTitle ( note . title ) } .md` ,
106
106
'text/markdown'
107
107
)
108
108
return
@@ -256,7 +256,7 @@ export const exportNoteAsPdfFile = async (
256
256
note . tags . length > 0 ? `, tags: [${ note . tags . join ( ' ' ) } ]` : ''
257
257
const headerFooter : Record < string , string > = {
258
258
title : `${ note . title } ${ tagsStr } ` ,
259
- url : `file://${ sanitizeNoteName ( note . title ) } .pdf` ,
259
+ url : `file://${ filenamifyNoteTitle ( note . title ) } .pdf` ,
260
260
}
261
261
const printOpts = {
262
262
// Needed for codemirorr themes (backgrounds)
@@ -272,7 +272,7 @@ export const exportNoteAsPdfFile = async (
272
272
. then ( ( data ) => {
273
273
if ( data ) {
274
274
// We got the PDF - offer the user to save it
275
- const pdfName = `${ sanitizeNoteName ( note . title ) } .pdf`
275
+ const pdfName = `${ filenamifyNoteTitle ( note . title ) } .pdf`
276
276
const pdfBlob = new Blob ( [ data ] , {
277
277
type : 'application/pdf' , // application/octet-stream
278
278
} )
0 commit comments