Can I post formatted Source Code on Facebook? [closed]
Asked Answered
F

4

22

I want to create a page on the Facebook, where I want to post Code from different languages.

  1. Does Facebook provide any means of posting formatted code on the wall?
  2. Is there an API for doing so on Facebook?
Frankfrankalmoign answered 19/9, 2013 at 18:21 Comment(8)
You can't post formatted source on a PostVibrations
Facebook AFAIK will let you write anything you want on your facebook page (modulo prohibitions against hate speech, etc.). Why wouldn't they let you write (formatted) source code? Whether there is an API for you to automate the posting of stuff on your page is another matter and I don't know the answer. If I were Facebook, I wouldn't allow it, as it is likely to turn instantly into a source of automated spam.Brassica
@IraBaxter Facebook either strips or interprets both MarkDown and HTML as literal text, so while you can post whatever content you want, you most certainly cannot format it how you want. Although I seen several suggested workarounds, but never tried them myself.Boz
@Master, there is absolutely not means of posting a private question on SO, or sharing it with anyone but all fellow members, as there is also not such thing as a private group. These ideas a contrary to all that SO was built on and stands for. AFAIK your only option there is some little known forum, or your own blog. The latter is so very easy to achieve, why not give that a go? If gather subscribers and regular readers, it is possible with either customization or some add-in, to assign them to private groups, whose members are the only ones granted access to certain pages or post types.Boz
for q3. now there is SO for teams.Gottschalk
April 22, 2019 4 spaces and your post should have a grey background that enables the code format. (only works in new posts)Lorettelorgnette
This works on Stack, not on FacebookIntermezzo
no way in comments🥲Branching
C
8

July 2019 update

You can do it in two ways, but only in group posts.

  • using markdown syntax (``` before and after the code snippet)
  • using 4 spaces before each line of code

IMPORTANT: it only works when you actually type out the backticks or spaces, it doesn't work when you copy and paste the entire post.

Couch answered 11/7, 2019 at 17:42 Comment(4)
Doesn't appear to work now (November 2020)Asp
No, it doesnt workOpportunity
I've tried this was already working in the past, but now it doesn't work anymore. I wonder why?Petasus
code blocks do not work, but simpler markdown formattings do work: H1, H2, quotes, bold, italics, (un)ordered lists. Just type any text and select it, a tooltip will appear with the formattings optionsShushubert
G
6

Short answers to short, on-point questions:

(Jan 2018)

1. No

2. No

(Updated Jan 2022)

Gottschalk answered 12/1, 2018 at 14:58 Comment(1)
Only on Workplace. But you can in Messenger [desktop only]Enthymeme
S
-4

You can use static html to write your own codes on a facebook page. It will create new tabs where you can write all html, javascript codes as you wish.

Stipple answered 5/6, 2017 at 19:42 Comment(0)
L
-5

Save the code and paste it into your Facebook wall as an image.

Lexi answered 29/6, 2020 at 13:15 Comment(1)
Why should that be a good idea? Any user willing to re-use the code would have to type it from the imageManheim

© 2022 - 2024 — McMap. All rights reserved.