Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No line wrap #25

Open
johanbaaij opened this issue Oct 29, 2022 · 3 comments
Open

No line wrap #25

johanbaaij opened this issue Oct 29, 2022 · 3 comments

Comments

@johanbaaij
Copy link

image

Wrapping works fine in my .md files. Perhaps it is an issue introduced in a newer Obsidian version since this plugin was released?

SYSTEM INFO:
	Obsidian version: v1.0.3
	Installer version: v0.15.9
	Operating system: Darwin Kernel Version 21.6.0: Wed Aug 10 14:28:23 PDT 2022; root:xnu-8020.141.5~2/RELEASE_ARM64_T6000 21.6.0
	Login status: logged in
	Catalyst license: none
	Insider build toggle: off
	Live preview: on
	Legacy editor: off
	Base theme: adapt to system
	Community theme: none
	Snippets enabled: 0
	Restricted mode: off
	Plugins installed: 4
	Plugins enabled: 4
		1: Dataview v0.5.47
		2: CookLang Editor v0.3.0
		3: Templater v1.14.3
		4: Tasks v1.16.0

RECOMMENDATIONS:
	Community plugins: for bugs, please first try updating all your plugins to latest. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community plugins.
@shayaknyc
Copy link

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.

@codingkoi
Copy link

Looks like something might have changed in Obsidian that's causing this issue. I found if I changed this line in cookView.ts1 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.02. 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.

Footnotes

  1. https://forum.obsidian.md/t/new-v1-0-took-away-line-wrap-in-the-editor-settings/44937

@shayaknyc
Copy link

shayaknyc commented Jun 15, 2023

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.

  1. Close down obsidian

  2. 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]

  3. 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'),

  4. 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:
image
(see highlighted areas)

  1. Save the file, close it, then reload Obsidian, and the source view should now properly display cooklang files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants