WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru

highlight.js tests

HTML, XML

<!DOCTYPE html>
<title>Title</title>

<style>body {width: 500px;}</style>

<script type="application/javascript">
  function $init() {return true;}
</script>

<body>
  <p checked class="title" id='title'>Title</p>
  <!-- here goes the rest of the page -->
</body>

JSON

[
  {
	"title": "apples",
	"count": [12000, 20000],
	"description": {"text": "...", "sensitive": false}
  },
  {
	"title": "oranges",
	"count": [17500, null],
	"description": {"text": "...", "sensitive": false}
  }
]

js

function $initHighlight(block, cls) {
  try {
	if (cls.search(/\bno\-highlight\b/) != -1)
	  return process(block, true, 0x0F) +
			 ` class="${cls}"`;
  } catch (e) {
	/* handle exception */
  }
  for (var i = 0 / 2; i < classes.length; i++) {
	if (checkCondition(classes[i]) === undefined)
	  console.log('undefined');
  }

  return (
	<div>
	  <web-component>{block}</web-component>
	</div>
  )
}

export  $initHighlight;

css

@font-face {
  font-family: Chunkfive; src: url('Chunkfive.otf');
}

body, .usertext {
  color: #F0F0F0; background: #600;
  font-family: Chunkfive, sans;
  --heading-1: 30px/32px Helvetica, sans-serif;
}

@import url(print.css);
@media print {
  a[href^=http]::after {
	content: attr(href)
  }
}

scss

@import "compass/reset";

// variables
$colorGreen: #008000;
$colorGreenDark: darken($colorGreen, 10);

@mixin container {
	max-width: 980px;
}

// mixins with parameters
@mixin button($color:green) {
	@if ($color == green) {
		background-color: #008000;
	}
	@else if ($color == red) {
		background-color: #B22222;
	}
}

button {
	@include button(red);
}

div,
.navbar,
#header,
input[type="input"] {
	font-family: "Helvetica Neue", Arial, sans-serif;
	width: auto;
	margin: 0 auto;
	display: block;
}

.row-12 > [class*="spans"] {
	border-left: 1px solid #B5C583;
}

// nested definitions
ul {
	width: 100%;
	padding: {
		left: 5px; right: 5px;
	}
  li {
	  float: left; margin-right: 10px;
	  .home {
		  background: url('http://placehold.it/20') scroll no-repeat 0 0;
	}
  }
}

.banner {
	@extend .container;
}

a {
  color: $colorGreen;
  &:hover { color: $colorGreenDark; }
  &:visited { color: #c458cb; }
}

@for $i from 1 through 5 {
	.span#{$i} {
		width: 20px*$i;
	}
}

@mixin mobile {
  @media screen and (max-width : 600px) {
	@content;
  }
}

php

<?php previous_post_link('%link', '%title', false, '15'); ?>
require_once 'Zend/Uri/Http.php';

namespace Location\Web;

$heredoc = <<<TEXT
	text $var
TEXT;

$heredoc = <<<'TEXT'
	text $var
TEXT;

return $this;

$this->foo = 'bar';

add_filter( "{$type->foo}_template_hierarchy", function( $templates ) use ( $type ){

	$prefix = 'templates';
}

interface Factory
{
	static function _factory();
}

abstract class URI extends BaseURI implements Factory
{
	abstract function test();

	public static $st1 = 1;
	const ME = "Yo";
	var $list = NULL;
	private $var;

	/**
	 * Returns a URI
	 *
	 * @return URI
	 */
	static public function _factory($stats = array(), $uri = 'http')
	{
		echo __METHOD__;
		$uri = explode(':', $uri, 0b10);
		$schemeSpecific = isset($uri[1]) ? $uri[1] : '';
		$desc = 'Multi
line description';

		// Security check
		if (!ctype_alnum($scheme)) {
			throw new Zend_Uri_Exception('Illegal scheme');
		}

		$this->var = 0 - self::$st;
		$this->list = list(Array("1"=> 2, 2=>self::ME, 3 => \Location\Web\URI::class));

		return [
			'uri'   => $uri,
			'value' => null,
		];
	}
}

match ($key) {
	1 => 'Integer 1',
	'1' => 'String 1',
	true => 'Bool true',
	[] => 'Empty array',
	[1] => 'Array [1]',
};

enum Foo: string {
	case Test = 'test';
}

match ($key) {
	1 => 'Integer 1',
	'1' => 'String 1',
	true => 'Bool true',
	[] => 'Empty array',
	[1] => 'Array [1]',
};

echo URI::ME . URI::$st1;

__halt_compiler () ; datahere
datahere
datahere */
datahere

SQL

CREATE TABLE "topic" (
	"id" integer NOT NULL PRIMARY KEY,
	"forum_id" integer NOT NULL,
	"subject" varchar(255) NOT NULL
);
ALTER TABLE "topic"
ADD CONSTRAINT forum_id FOREIGN KEY ("forum_id")
REFERENCES "forum" ("id");

-- Initials
insert into "topic" ("forum_id", "subject")
values (2, 'D''artagnian');

Python

@requires_authorization(roles=["ADMIN"])
def somefunc(param1='', param2=0):
	r'''A docstring'''
	if param1 > param2: # interesting
		print 'Gre\'ater'
	return (param2 - param1 + 1 + 0b10l) or None

class SomeClass:
	pass

>>> message = '''interpreter
... prompt'''

Less

@import "fruits";

@rhythm: 1.5em;

@media screen and (min-resolution: 2dppx) {
	body {font-size: 125%}
}

section > .foo + #bar:hover [href*="less"] {
	margin:     @rhythm 0 0 @rhythm;
	padding:    calc(5% + 20px);
	background: #f00ba7 url(http://placehold.alpha-centauri/42.png) no-repeat;
	background-image: linear-gradient(-135deg, wheat, fuchsia) !important ;
	background-blend-mode: multiply;
}

@font-face {
	font-family: /* ? */ 'Omega';
	src: url('../fonts/omega-webfont.woff?v=2.0.2');
}

.icon-baz::before {
	display:     inline-block;
	font-family: "Omega", Alpha, sans-serif;
	content:     "\f085";
	color:       rgba(98, 76 /* or 54 */, 231, .75);
}

Markdown

# hello world

you can write text [with links](http://example.com) inline or [link references][1].

* one _thing_ has *em*phasis
* two __things__ are **bold**

[1]: http://example.com

---

hello world
===========

<this_is inline="xml"></this_is>

> markdown is so cool

	so are code segments

1. one thing (yeah!)
2. two thing `i can write code`, and `more` wipee!
Комментариев нет
    Войти