cancel
Showing results for 
Search instead for 
Did you mean: 

SQLA2: What's the reasoning behind the ":::SQL" prefix/marker?

VolkerBarth
Contributor
0 Kudos
1,613

This is a question originally asked in the beta of the new SQL Anywhere forum:

The "Markdown Basics" on the right side suggest to:

Code blocks should be indented by 4 spaces.

SQL code should begin with ":::SQL" on the first line.

Why? What is the effect of this prefix?

Accepted Solutions (1)

Accepted Solutions (1)

graeme_perrow
Advisor
Advisor

This tells the markdown code that the following block is SQL and it will colour the text accordingly. To wit:

select * from table where name like 'Volker%' order by id asc;

Note how SQL keywords (not all SQL Anywhere keywords - TODO) are coloured. Without the ":::SQL" it just shows up like this:

select * from table where name like 'Volker%' order by id asc;

If you don't have a language indicator, the markdown code attempts to determine what language it is, but I've found usually gets it wrong. In the preview window, you do not see the syntax colouring but in the final result, it should show up - and the ":::SQL" line should vanish.

You can use a whole bunch of language indicators: ":::bash" for shell scripts, ":::C", ":::C++", ":::python", ":::perl", etc.

graeme_perrow
Advisor
Advisor

Note that the code highlighting will not show up until this question is migrated to sqlanywhere-forum.sap.com.

VolkerBarth
Contributor
0 Kudos

@Graeme: Just in time - can you please explain why that prefix doesn't work in that answer I've just edited to include it (and have tried it several times yesterday with no luck)?

graeme_perrow
Advisor
Advisor

There's some weirdness with lists. There was no way for markdown to detect the end of the list so it tried to include the code block in the list element and did not format it as a code block. The "solution" was to end the list and add a separate paragraph after the end of the list.

Answers (0)