← Back to Dictionary

Code-Block

Podcast 1 · Introduction

Code-Block /kəʊd blɒk/ · noun

A short documentary narration — meaning, origin, and how the word is used.

In this course, a code block is a section of programming code displayed separately from the surrounding text, usually in a monospace font with a distinct background, so it is easy to read and copy. The related entry for bullet points gives a related word, and the Cambridge definition of code-block and the Merriam-Webster entry for code-block give the main sense. For more background, see the encyclopaedia article on code-block.

Ready
Podcast 2 · Daily Use

In Conversation

Two British speakers using "code-block" naturally in everyday talk.

Ready
Podcast 3 · Prompt Engineering

Prompting with "code-block"

An instructor and developer explore real, copy-ready AI prompts built around the word.

Ready
1 / 3

Transcript: “Code block” vocabulary micro-course

Read along with the three podcasts, or open the full dictionary entry for Code block for the definition, Arabic meaning, synonyms and example sentences.

Podcast 1 — Introduction & meaning

Narrator: Today's word is "Code-Block" — noun, pronounced /kəʊd blɒk/, with the stress on "first".

Narrator: Today's word is "Code Block" — noun, pronounced /kəʊd blɒk/, with the stress on "first".

Narrator: A code block is a section of the programming code displayed separately from the surrounding text, usually in a monospace font with a distinct background, so that it is easy to read and to copy.

Narrator: In plain English, it is the boxed code, like the grey box in the tutorial with the commands inside, so the code block sets the code apart, and the reader can read it as the code, not the prose, and copy it with one click in the good interfaces.

Narrator: The word code comes from the Latin codex, meaning a book, and block from the Old French bloc, meaning a lump, so a code block is a lump of the book, which in practice means a chunk of the code, and the term entered the writing with the technical documentation.

Narrator: A common collocation is to format as a code block, which describes the act of setting the code apart, and which is the standard use of the phrase.

Narrator: It differs from inline code, which is a snippet in the sentence, because a block is the section, so it is about the size, not just the styling, which is why it is used for the multi line code, since the point is the readability.

Narrator: A second collocation is a copyable code block, which describes a block with the copy button, and which is a common phrase in the developer docs.

Narrator: Programming, documentation, and any technical writing all rely on code blocks for the readability.

Narrator: So remember: a code block is the boxed code, and its value is that it sets the code apart for the reading and the copying, but the block must be correct, since a broken code in a box is still broken, so test it, and the word is about the format, not the content.

Read podcasts 2 and 3

Podcast 2 — In conversation

Speaker A: The tutorial shows the commands in a code block. What is it?

Speaker B: CODE BLOCK combines code, from the Latin codex, meaning a book, with block, from the Old French bloc, meaning a lump. It is the section of code displayed separately, usually in the monospace font with the background, so it is easy to read and to copy, and the tutorial uses it so you can tell the code from the prose.

Speaker A: So is it just the styling?

Speaker B: The styling is the form, but the purpose is the separation. A code block tells the reader this is the code, not the text, and the copy button makes it usable, so it is about the readability and the function, not just the grey box.

Speaker A: Example sentences?

Speaker B: "Format it as a code block." That means set it apart. "The code block is copyable." That tells us there is a button. "The tutorial has three code blocks." That shows the count.

Speaker A: Common mistakes?

Speaker B: A common one is putting the prose in the code block, which confuses, so only the code goes in. Another is a broken code in the block, so test it, since a box around a broken command does not fix it.

Speaker A: Close relatives?

Speaker B: A cousin is the inline code, which is the snippet. A twin is the preformatted text, which is similar. An alternative is the snippet, which is broader — but code block keeps its readable charm!

Podcast 3 — Prompt engineering

Speaker B: Let's use "Code-Block" in AI prompts — useful for displaying code in a documentation app.

Speaker A: Let's use "code block" in AI prompts — useful for building a documentation feature and for a developer tool.

Speaker B: I am building a documentation app. How do I display the code blocks?

Prompt: Build a documentation feature that displays the code in the blocks, with the monospace font and the copy button. Let the user copy with one click. Let the team add the blocks. Check that the feature works by viewing a doc and confirming the block copies.

Speaker A: Build a documentation feature for a developer app that displays the code in the blocks, with the monospace font and the distinct background, and a copy button. Let the user copy with one click. Let the team add the blocks. Check that the feature works by viewing a doc with a code block, confirming the styling is distinct, and that the copy button puts the code on the clipboard.

Speaker B: How do I let the users submit the code blocks?

Prompt: Build a submission feature that lets the users submit the code snippets, formatted as the blocks. Let the team review. Let the good ones publish. Check that the feature works by submitting a snippet and confirming it is reviewed.

Speaker A: Build a submission feature for my app documentation that lets the users submit the code snippets, formatted as the blocks. Let the team review the submissions. Let the good ones publish to the docs. Check that the feature works by submitting a snippet, confirming it appears for the review, and that a approved one publishes.

Speaker B: Our app has a syntax highlighting feature. How do I use it?

Prompt: Build a syntax highlighting feature that colours the code in the blocks by the language. Let the user see the highlighted code. Let the team set the language per block. Check that the feature works by viewing a block and confirming the colours appear.

Speaker A: One more?

Speaker B: Build a syntax highlighting feature for my app that colours the code in the blocks by the language. Let the user see the highlighted code. Let the team set the language per block. Check that the feature works by viewing a block with the language set, confirming the keywords are coloured, and that changing the language changes the highlighting.

Prompt: One more?