diff --git a/src/plugins/files.rs b/src/plugins/files.rs index 64dfab1..5a35e90 100644 --- a/src/plugins/files.rs +++ b/src/plugins/files.rs @@ -142,12 +142,14 @@ fn cmd_create( // Append content if let Some(ref c) = content { note_content.push_str(c); - } else if note_content.is_empty() { + } else if !is_terminal::is_terminal(io::stdin()) { + // Read the body from stdin when -c/--content is not provided, even if + // tags or a template already populated note_content (frontmatter). + // The previous guard (note_content.is_empty()) skipped stdin whenever + // --tags or a template had written frontmatter, silently dropping body. let mut buffer = String::new(); - if !is_terminal::is_terminal(io::stdin()) { - io::stdin().read_to_string(&mut buffer)?; - note_content = buffer; - } + io::stdin().read_to_string(&mut buffer)?; + note_content.push_str(&buffer); } if !note_content.ends_with('\n') {