Code Blocks are now live in beta

šŸš€Product Updates
ā€¢
April 21, 2022
Cover for Code Blocks are now live in beta

Happy to share that now you can post code samples on Virality. This is a new feature so it will take a while to stabilize it but it already supports the syntax for 34 most commonly used languages.

import { Fragment } from 'react';

const helloWorld = (name) => console.log(`Hello World, from ${name}`);

To use Code Blocks you can type 3 back-ticks(```) or three tildes(āˆ¼āˆ¼āˆ¼) and a space. To exit press Enter 3 times or the Arrow Down.

A small trick is to add the language when you are opening the block so you can make sure the syntax will be the correct one. That would be something like ```language(e.g javascript) or something similar.

The supported languages for now are: Bash, C, C#, C++, CSS, Diff, Go, HTML,, XML, JSON, Java, JavaScript, Kotlin, Less, Lua, Makefile, Markdown, Objective-C, PHP, PHP, Template, Perl, Plain, text, Python, Python, REPL, R, Ruby, Rust, SCSS, SQL, Shell, Session, Swift, TOML, INI, TypeScript, Visual, Basic, .NET and YAML.

Hope you'll enjoy this new feature and if you happen to come across any glitches please let us know.

Share this post on Twitter

Published with

Virality