codebook/examples/example.md at main · blopker/codebook · GitHub
Skip to content

Latest commit

 

History

History
173 lines (121 loc) · 2.58 KB

example.md

File metadata and controls

173 lines (121 loc) · 2.58 KB

Markdown Injection Test File

This file exercises multi-language injection and edge cases.

Basic prose with typos

I'm bvd at splellin. Some regulr text with misspeled words.

Fenced code blocks with known languages

Python function with a typo in the name:

# A coment about the functin
def calculat_user_age(bith_date: str) -> int:
    """Calculaet the user's age from a date strng."""
    user_age = get_current_date() - bith_date
    return user_age

Bash commands (bash.scm doesn't capture command invocations):

# Instal dependencies for the proejct
mkdir -p build/outpt
cp src/*.rs build/outpt/
echo "Doen compiling"

Rust with various identifier types:

// Calclate the user's scroe
fn calculat_score(usr_input: &str) -> u32 {
    let mut scroe = 0;
    let mesage = "Helo Wolrd";
    scroe
}

JavaScript with strings and comments:

// Procss the usr requet
function handl_request(requst) {
    const mesage = "Somthing went wrng";
    return mesage;
}

Language aliases

Common aliases should resolve correctly:

def wrld_functin():
    pass
function wrld_functin() {}
fn wrld_functin() {}
# A coment in shell
echo "doen"
function wrld_functin(): void {}

Unknown and missing language tags

Unknown language (should be completely skipped):

      PROGRAM BADSPELIN
      WRITE(*,*) 'This shuld not be chekced'
      END

No language tag (should be completely skipped):

badwwword and uncheckedtypo should not appear

Block-level HTML (injected as HTML)

This paragraf has a misspeled word inside HTML.

Another sentance with erors.

Inline HTML in prose (not separately injected)

Some text with boldd and italc formatting.

Block quotes

A block quoet with misspeled words should be chekced normally.

Nested block quote:

A neested quoet inside another quoet.

Many code blocks (stress test for recursion)

x = "frst"
echo "secnd"
y = "thrd"
let z = "fouth";
let w = "fifh";
a = "sixh"

Mixed content ordering

Text before. Then code:

def befre_and_aftr():
    pass

Text between code blocks with a tyypo.

// Anothr comment
fn middl_function() {}

More text aftr the code.

Edge cases

Empty code block with language:

Single-line code block:

x = "singel"

Code block at end of file with no trailing newline:

y = "finl"