Chap
Code
[code] shortcode can display blocks of code with syntax highlighting, powered by Prism.
Code shortcode arguments
languageLanguage [html|css|php|js|more...] (default: WP shortcode)
titleTitle
show_languageShow language name in the title (default: true)
Highlighted shortcode
Shortcode
Button
[button red large]Hello[/button]
[code title="Button"][button red large]Hello[/button][/code]
HTML
<button class="ui primary button">Click here</button>
[code language="html"]<button class="ui primary button">Click here</button>[/code]
CSS
button.big#bad {
  background-color: transparent;
}
[code language="css"]
button.big#bad {
  background-color: transparent;
}
[/code]
LESS
button {
  &.big {
    &#bad {
      background-color: transparent;
    }
  }
}
[code language="less"]
button {
  &.big {
    &#bad {
      background-color: transparent;
    }
  }
}
[/code]
SASS
button {
  &.big {
    &#bad {
      background-color: transparent;
    }
  }
}
[code language="scss"]
button {
  &.big {
    &#bad {
      background-color: transparent;
    }
  }
}
[/code]
CSS
button.big#bad {
  background-color: transparent;
}
[code language="css"]
button.big#bad {
  background-color: transparent;
}
[/code]
PHP
<?php echo 'Lorem'; ?>
[code language="php"]<?php echo 'Lorem'; ?>[/code]
JavaScript
console.log('Lorem', var);
[code language="js"]console.log('Lorem', var);[/code]
JSON
{
  "name": "chap",
  "version": "1.0.0",
  "author": "websevendev <websevendev@gmail.com>"
}
[code language="json"]
{
  "name": "chap",
  "version": "1.0.0",
  "author": "websevendev <websevendev@gmail.com>"
}
[/code]
SQL
INSERT INTO STATION VALUES (13, 'Phoenix', 'AZ', 33, 112);
[code language="sql"]
INSERT INTO STATION VALUES (13, 'Phoenix', 'AZ', 33, 112);
[/code]
Bash
BASH
Install WP-CLI
#!/bin/bash
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
[code language="bash" title="Install WP-CLI"]
#!/bin/bash
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
[/code]

Supported languages

Code highlighting features in Chap WordPress theme are powered by Prism JS syntax highlighter plugin.
Exit mobile version