-
Notifications
You must be signed in to change notification settings - Fork 23
Conversation
Fixes #38 |
// considered code and pasted as-is. | ||
func postToPlayground(text string) string { | ||
var pg string | ||
parts := strings.Split(text, "```") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we just bail if this is < 2
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure, I've seen a few posts where the author forgot the second ```.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, good point. 👍
Sorry, this won't be merged as the intention is to get people to use the playground when appropriate. Thank you for your time and help. |
@dlsniper I'm not sure I follow. This will still encourage people to use the playground, but would generate more functional code when the snippet is pasted to the playground. As someone who spends a lot of his time helping on Slack via a mobile phone, this is a common pain point for me. Would you be able to share more context around your concerns? I am strongly in favor of re-opening this PR with the intent to merge. |
@theckman we discussed this extensively to the point that I should write a bot command to reply to this. The purpose of this is not to make the bot smarter, but the humans. The fact that humans paste large swats of code/text freely and break conversations is more annoying than a message telling the user to stop doing it. So if you are annoyed by a single line message, I find it surprising that messages larger than 10 lines don't annoy you. |
@dlsniper sure, I agree on the intent. But when it happens, it doesn't make sense that it generates broken code if someone has text with the code snippet. If you're not in favor of merging this, would you be amenable to a PR just removing the functionality and putting in place an alias? |
Sorry for the format change.
This PR adds the functionality to identify code sections in a post and generate a useful code for the playground. The non-code parts are inserted as comments.
I've not used the
strings.Builder
for backwards compatibility reasons. I can add it if required.Happy Hacktoberfest,
Tim