Question: Add extra break after each line possible with inline-scripts?
Hi, I was curious if it would be possible to create a script that would add a
or the like at the end of a line. I'm unsure if this falls in the scope of this plugin though so please let me know if not!
So for instance this:
This is one sentence.
This is a second one that goes on a bit longer.
Here is a line with two sentences. This is the second sentence.
becomes
This is one sentence.
This is a second one that goes on a bit longer.
Here is a line with two sentences. This is the second sentence.
Thank you for all your work on the plugin! Its great!
It is possible but you would need some knowledge of inlineScripts, JavaScript and the Obsidian API (search for read and write (cached) file methods in the obsidian API docs in that case. I would arrange the custom sfile algorithm as follows, assuming that, this is what you are looking for:
- open note which should be adjusted (manually by clicking it or you could even create a dropdown with inlineScripts letting you choose a folder and file to read)
- Read whole note text on click of a inlineScript button on the right sidebar (or without manually starting your sfile by button-click: if you preferred the file selection method from point 1, the read algorithm can go right after the file selection (via popups) part)
- Search for every paragraph
\nand change it to\n\nor whatever you like to do else/instead - Overwrite the note file with this new string content
Alternatively I would recommend checking out the TextFormat plugin, not sure if it fits your needs but could be worth checking out. I remember, it was repairing broken paragraphs and much more but I basically only used it for that.