Skip to content

Instantly share code, notes, and snippets.

@Jermolene
Created March 13, 2015 11:24
Show Gist options
  • Save Jermolene/9ed9c11ff79f5c847ce8 to your computer and use it in GitHub Desktop.
Save Jermolene/9ed9c11ff79f5c847ce8 to your computer and use it in GitHub Desktop.
Hack to double line breaks in selected tiddlers
$tw.utils.each($tw.wiki.filterTiddlers($tw.wiki.getTiddlerText("$:/temp/advancedsearch")),function(title) {var tiddler=$tw.wiki.getTiddler(title);$tw.wiki.addTiddler(new $tw.Tiddler(tiddler,{text: tiddler.fields.text.replace(/\n/mg,"\n\n")}))});
@Jermolene
Copy link
Author

A hack to replace single line breaks with double line breaks in selected tiddlers

  1. Use the $:/AdvancedSearch ''Filter'' tab to create and verify a filter expression to select the tiddlers you wish to modify
  2. Open the browser developer console
  3. Paste the code above
  4. Press enter

@Jermolene
Copy link
Author

Here's a variant that adds """ to the top and bottom of each tiddler:

$tw.utils.each($tw.wiki.filterTiddlers($tw.wiki.getTiddlerText("$:/temp/advancedsearch")),function(title) {var tiddler=$tw.wiki.getTiddler(title);$tw.wiki.addTiddler(new $tw.Tiddler(tiddler,{text: "\"\"\"\n" + tiddler.fields.text.replace(/\n/mg,"\n\n") + "\n\"\"\"\n"}))});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment