Skip to content

Code Feature Demo

Inline Code

Create a file with body { color: red; }

With Lang

Create a file with body { color: red; }

Plain Code

if weather == "sunny":
    print("It will be sunny today")
    print("Wear sunscreen!")

print("Time to go to the beach...")

With Lang

if weather == "sunny":
    print("It will be sunny today")
    print("Wear sunscreen!")

print("Time to go to the beach...")

Line Numbering

if weather == "sunny":
    print("It will be sunny today")
    print("Wear sunscreen!")

print("Time to go to the beach...")

Line HIghlighting

if weather == "sunny":
    print("It will be sunny today")
    print("Wear sunscreen!")

print("Time to go to the beach...")

With Line Nos.

if weather == "sunny":
    print("It will be sunny today")
    print("Wear sunscreen!")

print("Time to go to the beach...")

Code Notes

from typing import Iterator

print("Hello, world!") # (1)!

# This is an example
class Math:
    @staticmethod # (2)!
    def fib(n: int) -> Iterator[int]:
        """Fibonacci series up to n."""
        a, b = 0, 1
        while a < n:
            yield a
            a, b = b, a + b

result = sum(Math.fib(42))
print(f"The answer is {result}")
  1. Do this thing!
  2. And this

Code Indentation

def report():
    while True:
        weather = input("Weather today: ")
        if weather == "sunny":
            print("It will be sunny today")
            print("Wear sunscreen!")

            if time == "now":
                print("Ding!")
            else:
                print("Dong!")

    print("Time to go to the beach...")

How to Indent and Unindent Code

You can use the spacebar to indent code, but there is a better way...

  • Press the Tab key to indent the code (push it right by four spaces)
  • Press Shift + Tab to unindent the code (pull it left, removing four spaces)

Long Code Lines

<p>Behind every man now alive stand thirty ghosts, for that is the ratio by which the dead outnumber the living. Each day means a new twenty-four hours- each day means everything's possible again - you live in the moment, you die in the moment, you take it all one day at a time. It's a strange thing: We humans pride ourselves on being ruled by reason, yet with human civilization at stake, we chose ideology and ignorance.</p>

<p>In this age of enlightenment, the soothsayer and astrologer flourish; as science pushes forward, ignorance and superstition gallop around the flanks and bite science in the rear with big dark teeth. Then, as his planet killed him, it occurred to Kynes that his father and all the other scientists were wrong, that the most persistent principles of the universe were accident and error.</p>