[Open] A good way to share code

Hi coming from the Drafts Forum where we have the Action Directory to share complex code easily I was wondering if there is a good way to share code in this Forum?


It depends on the code.

Some apps like Shortcuts or Drafts let you share a direct link to some actionable content.

Others like Scriptable, people have written scripts to allow you to retrieve code from a gist (on GitHub).

Using triple back ticks allows you to share code within a post which is suitable for many sets of code. If it is really long and you don’t want it to overtake the conversation, put your code block in a ‘hide details’ block so that it has to be expanded first.

Now, there is the old wiki page, but it never got maintained, and I’m guessing that it would only be a fraction of 1% of people who use the forum who even remembered that it existed, to be able to look for it and actually find it.

If this is something where people feel it would be useful, perhaps @RosemaryOrchard could look at options for making this and other useful information more front and centre for joiners? For example, the use of code blocks is something that still comes up once or twice a month on average. Partial screenshots of shortcuts people want debugging when they could share the link. I’m just not so sure how many people would take such things on board, but perhaps being able to just link people to the page with details or having a Discourse bot scan people’s posts and message them if it spots something that looks like it could be better?


A nice avenue to look at.

That would be amazing. I have to check with the folks/documentation at Discourse how that could be done.