@@ -17,7 +17,7 @@ const DEFAULT_SETTINGS: PluginSettings = {
17
17
apiToken : null ,
18
18
lastUpdated : null ,
19
19
autoSync : true ,
20
- highlightSortOldestToNewest : false ,
20
+ highlightSortOldestToNewest : true ,
21
21
} ;
22
22
23
23
export default class ReadwiseMirror extends Plugin {
@@ -75,7 +75,7 @@ ${text} ${book.category === 'books' ? locationBlock : ''}${color ? ` %% Color: $
75
75
last_highlight_at,
76
76
source_url,
77
77
} = book ;
78
- const fileName = `${ title . replace ( / [ < > : " \/ \\ | ? * ] + / g, '' ) } .md ` ;
78
+ const sanitizedTitle = `${ title . replace ( ':' , '-' ) . replace ( / [ < > " ' \/ \\ | ? * ] + / g, '' ) } ` ;
79
79
80
80
const formattedHighlights = ( this . settings . highlightSortOldestToNewest ? highlights . reverse ( ) : highlights )
81
81
. map ( ( highlight : Highlight ) => this . formatHighlight ( highlight , book ) )
@@ -101,15 +101,18 @@ Updated: ${this.formatDate(updated)}
101
101
 . replace ( 'SY160' , 'SY500' ) } )
102
102
103
103
# About
104
- Title: [[${ title } ]]
104
+ Title: [[${ sanitizedTitle } ]]
105
105
${ authors . length > 1 ? 'Authors' : 'Author' } : ${ authorStr }
106
106
Category: #${ category }
107
107
Number of Highlights: ==${ num_highlights } ==
108
108
Last Highlighted: *${ last_highlight_at ? this . formatDate ( last_highlight_at ) : 'Never' } *
109
109
Readwise URL: ${ highlights_url } ${ category === 'articles' ? `\nSource URL: ${ source_url } \n` : '' }
110
110
111
111
# Highlights ${ formattedHighlights } ` ;
112
- let path = `${ this . settings . baseFolderName } /${ category . charAt ( 0 ) . toUpperCase ( ) + category . slice ( 1 ) } /${ fileName } ` ;
112
+
113
+ let path = `${ this . settings . baseFolderName } /${
114
+ category . charAt ( 0 ) . toUpperCase ( ) + category . slice ( 1 )
115
+ } /${ sanitizedTitle } .md`;
113
116
114
117
const abstractFile = vault . getAbstractFileByPath ( path ) ;
115
118
0 commit comments