Skip to content

Instantly share code, notes, and snippets.

@AloofBuddha
Last active October 20, 2022 15:37
Show Gist options
  • Save AloofBuddha/a3d196373318aab8a91340b345d256b9 to your computer and use it in GitHub Desktop.
Save AloofBuddha/a3d196373318aab8a91340b345d256b9 to your computer and use it in GitHub Desktop.
Markup as an idea

Markup as an idea

What is markup

markup is just the general idea that you can represent information as 'code' using a data structure.

so for example, JSON counts as a markup language:

{
  "title": "hello world",
  "isFalse": true,
  "data": 11100000111100
}

JSON is importantly not JavaScript it's a subset to describe objects only, it's meant purely for representing data.

What is Markup not

This isn't trivial, the idea of markup is based mostly in what it isn't - markup isn't a programming language!

In an academic setting you would say markup is not Turing-complete. For a language to be Turing-complete it needs to be able to represent data and algorithms. Not just one, both!

So for example, JavaScript is a turing-complete language because it can do this:

const x = 'hello world';

const f = (str) => {
  console.log(str);
};

f(x); // logs "hello world"

Every programming language you will ever encounter can do this, or it wouldn't be very useful! So when we say 'programming language' we mean a language that does both algorithms and data.

To be clear though a 'markdown language' is not inferior to a 'real' language. In terms of total abilities, yes. But there's a major benefit in using a markdown language when all you want is to represent data that will not change over time.

That's why HTML was chosen to represent web pages. In the earliest days of the internet the assumption was a webpage would be a static object represented by HTML. A client visits puts a url in the browser, the site's server responds to the client request with a single HTML doc, and the client's browser they reads and displays a web page. That's it! Modern web development is more complicated in that the served page is not more like a 'starting point' which is then continually manipulated by JavaScript and new data requested from the backend, but HTML was what Web 1.0 was all about, and it turns out a lot is possible before you even add the programmatic layer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment