Get up to 80 % extra points for free! More info:

Lesson 2 - Advanced ICT syntax in SocialTexy

Social constants

Warning! Tokens in this article are written using invisible spaces to prevent them being processed. If you just copy them to your article, it might not work, re-type them, please.

Console blocks

To avoid messing with screenshots, which are difficult to maintain, you can wrap text output to make it look like an actual console window.

{‌TITLE}

Specifies the console title. The default title will be used if not specified.

Run your app by pressing F5 and you should see a console window like this:

/---console csharp
{‌TITLE}Your first C# .NET app{‌/TITLE}
Hello world!
\---
Result
Your first C# .NET app
Hello world!

You can use HTML markup to style the output, e.g. to colorize text. On the other hand, if you plan to print plain HTML/XML, you have to convert such text to entities first to display it in the console properly.

Browser blocks

As same as a console window, you can generate a web browser window. The code will be displayed in an isolated sandbox.

Syntax

Our web will not look like this:

/---browser
{‌TITLE}Your first page{‌/TITLE}
{‌URL}localhost{‌/URL}
<p>Hello world!</p>
\---
{‌TITLE}

You can specify the title using the TITLE token.

{‌URL}

You can specify the URL using the URL token. The URL has to be specified after the title.

Result
Your first page
localhost

Compiler blocks

Real-time code compilers for different languages can be easily inserted into articles as compiler blocks.

{‌HIDE}

We declare a function like this:

/---code cpp
void function()
{
    printf("Hello");
}
\---

And then you call it like this in your code:

/---compiler cpp
{‌HIDE}
void function()
{
    printf("Hello");
}
{‌/HIDE}
main()
{
    function();
}
\---

{*_CONSOLE} and {/*_CONSOLE}

Replace * with the programming language.

/---compiler csharp
{‌CSHARP_CONSOLE}
Console.WriteLine("Hello world");
{‌/CSHARP_CONSOLE}
\---

will be translated to:

/---compiler csharp
{‌HIDE}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OnlineApp
{
    class Program{
        static void Main(string[] args) {
        // Your code snippet
{‌/HIDE}
Console.WriteLine("Hello world");
{‌HIDE}
        }
    }
}
{‌/HIDE}
\---
Result
Console.WriteLine("Hello world");

Article constants

{‌PREVIOUS_URL} and {‌NEXT_URL}

In the "previous lesson":[{‌PREVIOUS_URL}] ...

... In the "next lesson":[{‌NEXT_URL}] we'll...

{‌PREVIOUS} and {‌NEXT}

Render title and link to the previous resp. next article.

In this premium article, we'll...

{‌DOMAIN}

Inserts the current domain, like "ict.social".

{‌COUNTRY_ADJEC­TIVE}

Contains the current country as adjective (English or český).

Currencies

To support translating currencies automatically, wrap them as {‌M:EUR}€396{/M}.

{‌DESCRIPTION}

Inserts the current article description.

[‌screenshots] and [‌no_screenshots]

Screenshots of software articles are generated at the end of the article. The position can be specified by entering the [screenshots] constant:

...

Screenshots
###########
[screenshots]

Some other text...

{‌REFERENCES}

Inserts a reference slideshow to a given place in the article.

<kbd>

If you want to talk about pressing keys, use the <kbd> and </kbd> to do so:

Press <kbd>Enter</kbd>

Result

Press Enter

Conventions

  • Although Texy! supports HTML markup, don't use it.
  • Don't use other heading syntax than specified here.

 

Previous article
Basic text syntax in SocialTexy
All articles in this section
The SocialTexy syntax
Article has been written for you by David Capka Hartinger
Avatar
User rating:
No one has rated this quite yet, be the first one!
The author is a programmer, who likes web technologies and being the lead/chief article writer at ICT.social. He shares his knowledge with the community and is always looking to improve. He believes that anyone can do what they set their mind to.
Unicorn university David learned IT at the Unicorn University - a prestigious college providing education on IT and economics.
Activities