Open johanbaaij opened 1 year ago
Came here looking to see if someone else has this issue and I'm glad someone else posted it. When in writing mode, there doesn't appear to be any line-wrapping for files ending in .cook - which would "activate" the Cooklang spec in read mode. Read mode renders fine, but when in writing mode, the line keeps scrolling off the right past the pane edge, which makes things difficult to work with directly in Obsidian. My workaround has been to manually edit or create .cook files in the vault with a text editor.
Looks like something might have changed in Obsidian that's causing this issue. I found if I changed this line in cookView.ts
^code-link like this, it fixes the issue:
- lineWrapping: (this.app.vault as any).getConfig('lineWrap'),
+ lineWrapping: true,
From what I can uncover, it looks like this used to be a configurable setting but it was removed in 1.0^word-wrap. I could create a pull request to apply this fix, or alternatively add the setting into the Cooklang plugin settings so it's still an option if people want it, but it's not clear to me that this project is being closely maintained.
Honestly, the path of least resistance, as I'm not a developer and would have difficulty getting an environment set up sufficiently to apply the fix myself, and then build the plugin myself, and install it. Thank you for debugging this and finding a solution!
Edit: I've discovered where to patch this if you already have it installed as a plugin.
Close down obsidian
Find the main.js file in [VAULT_FOLDER]/.obsidian/plugins/cooklang-obsidian/main.js
. For example, I'm on Windows, so mine is saved in: Documents\Obsidian Vault\Recipes\.obsidian\plugins\cooklang-obsidian\main.js
Recipes
in the path above is my [VAULT_FOLDER]
Open the main.js
file in your favorite text editor and find the string lineWrapping
. Mine is on line 3642, which should contain the string:
lineWrapping: this.app.vault.getConfig('lineWrap'),
If you comment it out (with // right in front) just to keep it there just in case, and then add a new line underneath with the modified string @codingkoi suggested:
lineWrapping: true,
It should look something like this:
(see highlighted areas)
Wrapping works fine in my .md files. Perhaps it is an issue introduced in a newer Obsidian version since this plugin was released?