File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -510,7 +510,7 @@ export default {
510510 // line-break-at-document-end.ts
511511 'line-break-at-document-end' : {
512512 'name' : 'Line Break at Document End' ,
513- 'description' : 'Ensures that there is exactly one line break at the end of a document.' ,
513+ 'description' : 'Ensures that there is exactly one line break at the end of a document if the note is not empty .' ,
514514 } ,
515515 // move-footnotes-to-the-bottom.ts
516516 'move-footnotes-to-the-bottom' : {
Original file line number Diff line number Diff line change @@ -17,6 +17,10 @@ export default class LineBreakAtDocumentEnd extends RuleBuilder<LineBreakAtDocum
1717 return LineBreakAtDocumentEndOptions ;
1818 }
1919 apply ( text : string , options : LineBreakAtDocumentEndOptions ) : string {
20+ if ( text . length === 0 ) {
21+ return text ;
22+ }
23+
2024 text = text . replace ( / \n + $ / g, '' ) ;
2125 text += '\n' ;
2226 return text ;
@@ -46,6 +50,11 @@ export default class LineBreakAtDocumentEnd extends RuleBuilder<LineBreakAtDocum
4650 ${ '' }
4751 ` ,
4852 } ) ,
53+ new ExampleBuilder ( { // https://github.com/platers/obsidian-linter/issues/1228
54+ description : 'Empty files will not have a blank line added' ,
55+ before : dedent `` ,
56+ after : dedent `` ,
57+ } ) ,
4958 ] ;
5059 }
5160 get optionBuilders ( ) : OptionBuilderBase < LineBreakAtDocumentEndOptions > [ ] {
You can’t perform that action at this time.
0 commit comments