Open GitMurf opened 3 years ago
I added to YouTube. Video Demo on YouTube (no sound)
It is important that you select ALL the blocks for your SmartBlock including the parent #42SmartBlock NameOfSB
block as well before you copy it to the clipboard before running this SB to convert to format for GitHub. See the video for clarity.
UPDATED today to fix a bug when you have plain blank empty blocks in the middle of your SmartBlock
I think i figured out the small problem with the SB example format converter where it said "undefined" in front of your first block (the parent/title)
its because you had that block set as a "numbered list" instead of normal "bullet list" mode.
it appears there are issues if you are either in "document mode" or "numbered list" mode. This may be a pain to fix ughhhhh... but I'll try to figure it out... otherwise may have to just tell people they need to make sure they are in the "bullet mode"
See Issue #99 where Brandon had an issue.
Here is a video showing how to copy from Github into Roam and start using a smartblock:
https://github.com/roamhacker/SmartBlocks/issues/119#issuecomment-756413587
✂️ Copy of your #42SmartBlock from Roam
var cbText = await navigator.clipboard.readText(); var cbArr = cbText.match(/^.*([\n\r]+|$)/gm); var newFullString = ""; var nextIndent = ""; for (var i = 0; i < cbArr.length; i++) { var thisLine = cbArr[i]; if(thisLine.trim() == '-'){thisLine = thisLine.replace('- ','-');}
if(thisLine.trim().substring(0,1) == '-')
{
//Start of a block
//Find leading spaces (indent level)
var numOfSpaces = thisLine.indexOf('- ');
var newIndSpace = thisLine.substring(0,numOfSpaces/2);
var thisLineNew = nextIndent + newIndSpace + thisLine.trim().replace("- ","- "," ");
}
else
{
var thisLineNew = newIndSpace + ' ' + thisLine;
}
newFullString = newFullString + thisLineNew;
}
newFullString = newFullString + "
" + "
\n " + newIndSpace) + "\n"; nextIndent = newIndSpace + "" + "
\n"; thisLineNew = thisLineNew.replace("" + "
\n";await navigator.clipboard.writeText(newFullString); return 'Saved to Clipboard. Ready to paste SB Example into GitHub!';
📋 Describe the SmartBlock
Converts SB copied to clipboard from Roam into GitHub format that will copy/paste into other user's Roam correctly
✅ Describe any prerequisites or dependencies that are required for this SmartBlock
Make sure you first copy the SB that you want to share to your clipboard from Roam and then initiate this SB. It will update the clipboard with the proper text for you to paste into Github so that when other users try to copy your SB example it can be pasted directly into Roam without issues.
📷 Screenshot of your #42SmartBlock workflow/template from Roam
💡 Additional Info
Video Demo on YouTube (no sound)
https://youtu.be/vOUl_131Ogo