Examples 13

Add Syntax Anywhere to a site and it will find and highlight sections of code or markup within any block you can write fragments of code into, whatever the programming or markup language.

Syntax Anywhere supports a extendable range of Syntax Processors. Most of these support multiple programming languages, but perhaps not all languages. If you have an obsure language requirement, you may need to look through a few Syntax Processors to find support for your language requirements.

Most Syntax Processors provide multiple themes, so Syntax Anywhere provides a massive choice of how your code is presented. In these pages we show just a few examples.

View settings
Syntax Processor
Prism
Theme
Prism

php

[code language="php"]

// From within syntax anywhere's block controller

protected $btTable = "btJlSyntaxAnywhere";
protected $btInterfaceWidth = "680";
protected $btInterfaceHeight = "460";
protected $btCacheBlockOutput = true;
protected $btCacheBlockOutputOnPost = false;
protected $btCacheBlockOutputForRegisteredUsers = true;

public function getBlockTypeName()
{
    return Package::getByHandle('jl_syntax_anywhere')->getPackageName();
}

public function getBlockTypeDescription()
{
    return Package::getByHandle('jl_syntax_anywhere')->getPackageDescription();
}

[/code]

CSS

[code language="css"]
.ccm-page-background-credit {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: right;
    padding: 10px 30px;
    color: #989898;
    background-color: rgba(0, 0, 0, .5);
}

[/code]

HTML

[code language="html"]

<div class="my-class">
    <ol> 
        <li>List 1</li>
        <li>List2</li>
    </ol> 
</div>

[/code]

 

Javascript

[code language="javascript"]

if (typeof JtF.syntax_anywhere.debug === 'undefined') {
    /*
     * General fedback, mainly as developer debug.
     */
    JtF.syntax_anywhere.set_debug = function (flag) {
        JtF.syntax_anywhere.debug_flag = flag;
    };
    JtF.syntax_anywhere.debug = function () {
        if (!(JtF.syntax_anywhere.debug_flag && window.console && window.console.log)) {
            return;
        }
        if (!arguments.length) {
            window.console.trace && window.console.trace();
        } else if (arguments.length === 1) {
            window.console.log(arguments[0]);
        } else {
            window.console.log(arguments);
        }
    };
}

[/code]

C

[code language="C++"]

#include <stdio.h>
int main()
{
   // printf() displays the string inside quotation
   printf("Hello, World!");
   return 0;
}

[/code]

 

Python

[code language="python"]

password = ''

while password != 'password':
    print('What is the password?')
    password = input()

print('Yes, the password is ' + password + '. You may enter.')

[/code]

 

Assembler

[code language="x86asm"]

section .text

    global _start

_start:

        ; write our string to stdout.

        mov     edx,len   ; third argument: message length.
        mov     ecx,msg   ; second argument: pointer to message to write.
        mov     ebx,1     ; first argument: file handle (stdout).
        mov     eax,4     ; system call number (sys_write).
        int     0x80      ; call kernel.

        ; and exit.

    mov    ebx,0      ; first syscall argument: exit code.
        mov     eax,1     ; system call number (sys_exit).
        int     0x80      ; call kernel.

section .data

msg     db      "Hello, world!",0xa      ; the string to print.
len     equ     $ - msg                  ; length of the string.

[/code]

SQL

[code language="SQL"]

SELECT u.uID, ak_ifa_firstname, ak_ifa_surname, ak_ifa_business_name, ak_ifa_member_qualification, ak_ifa_area_specialism, ak_ifa_filter_research, ak_ifa_essential_oils, ak_ifa_carrier_oils, ak_ifa_ailments 
FROM Users u 
LEFT JOIN UserSearchIndexAttributes ua ON u.uID = ua.uID 
WHERE ak_ifa_filter_research IS NOT NULL
ORDER BY ak_ifa_filter_research DESC

[/code]