kevboh / longform

A plugin for Obsidian that helps you write and edit novels, screenplays, and other long projects.
Other
610 stars 30 forks source link

Bug: Unexpected Behavior when Compile Output Path set to Parent Folder #149

Closed kconedera closed 9 months ago

kconedera commented 1 year ago

Versions Longform version: 2.0.3 Obsidian version: 1.1.16 OS: Windows Theme: Things Other plugins: AidenLx's Folder Note

Describe the bug I use a folder note plugin that will connect a .md file to a folder with the same name, if that file is saved in the same parent directory as the folder. It works really well, and I like that I can set my own output path in the "Save as Note" step in Longform's compiler so that I can have it directly update the folder note I created for my Longform folder.

Currently, I have my output path set to "../$1.md", which saves the compiled manuscript to the parent folder of the Longform project, with the name set to the project name. As I have already set up a folder note for the Longform project, my compiled manuscript automatically populates in the folder note. It's great!

The one issue I've noticed, however, is that the "../" part of the output path pointing to the parent folder seems to be blocking the Longform plugin from opening the newly compiled .md file once it's compiled. I get the following notifications when compiling is complete:

"Compile Complete" "File names cannot end with a dot or a space"

Then, a new tab is opened in the background, and it stays on the "No file is open" screen.

This isn't a huge issue for me, but I wanted to report it because I think this is a somewhat uncommon use case that may have an easy workaround (i.e., a $0 variable set to the parent or root directory, or an option to supply an absolute path instead of a relative path). Alternatively, they may be some tweaking that can be done with how the plugin communicates with Obsidian so that it can open a wider variety of custom output paths without running into limitations with how Obsidian opens files. I'm not familiar with Obsidian's API so I can't say what the exact issue is, but I can say that the plugin is doing exactly what I'm asking it to, and it's just not displaying the completed file.

To Reproduce Steps to reproduce the behavior:

  1. In the longform tab, navigate to "Compile"
  2. Under the "Save as Note" step, enter "../$1.md" to the file path
  3. Click "Compile"

Expected behavior A new view tab should open displaying the newly compiled markdown note.

I've tested a few different output paths and found that the issue only appears when the "../" prefix is present in the output path. "$1.md" will work as expected, with the file being saved to the project folder.

I also tried compiling the file with no folder note set to the project file and "../$1.md" set to the output path. The same issue appeared whether or not a folder note or note by the same name already existed.

This is a fantastic plugin, thank you for working on it!

kevboh commented 1 year ago

Good catch! Seems easy enough to fix. Thanks.