Despite their confusion as to whether they want to really support their free and open source versions (without some absurd user count cliff), Mattermost (https://mattermost.com) is quite excellent and IMO is better than Slack. For example, editor leans towards native Markdown so things like syntax highlighting with backticks work as you expect.
Their recent update removed the paywall from SSO (and unfortunately the Gitlab SSO workaround) for social logins up to 100 seats, afterwards there's an absurd per seat cost similar to its non-open source brethren. One day if needed, I plan to drop-in an SSO middleman allowing anyone to leverage their own SSO layer (which will map to the login form with username/password) to avoid the SSO limits altogether. Though good enough for my needs, and likely yours too. Especially if you're open to paying for their seats.