Prepare for v2, s/markup/html/g in code blocks

This commit is contained in:
Isiah Meadows 2019-07-23 16:40:45 -04:00
parent 20f0759103
commit b580e241c8
6 changed files with 58 additions and 57 deletions

View file

@ -56,9 +56,9 @@ An easy way to try out Mithril is to include it from a CDN and follow this tutor
Let's create an HTML file to follow along:
```markup
```html
<body>
<script src="https://unpkg.com/mithril@next/mithril.js"></script>
<script src="https://unpkg.com/mithril/mithril.js"></script>
<script>
var root = document.body
@ -173,7 +173,7 @@ m.mount(root, Hello)
As you would expect, doing so creates this markup:
```markup
```html
<main>
<h1 class="title">My first app</h1>
<button>A button</button>

View file

@ -9,8 +9,8 @@
If you're new to JavaScript or just want a very simple setup to get your feet wet, you can get Mithril from a [CDN](https://en.wikipedia.org/wiki/Content_delivery_network):
```markup
<script src="https://unpkg.com/mithril@next/mithril.js"></script>
```html
<script src="https://unpkg.com/mithril/mithril.js"></script>
```
---
@ -18,7 +18,7 @@ If you're new to JavaScript or just want a very simple setup to get your feet we
### NPM
```bash
$ npm install mithril@next --save
$ npm install mithril --save
```
TypeScript type definitions are available from DefinitelyTyped. They can be installed with:
@ -46,7 +46,7 @@ $ npm init --yes
2. install required tools
```bash
$ npm install mithril@next --save
$ npm install mithril --save
$ npm install webpack webpack-cli --save-dev
```
@ -97,7 +97,7 @@ npm init --yes
Then, to install Mithril, run:
```bash
npm install mithril@next --save
npm install mithril --save
```
This will create a folder called `node_modules`, and a `mithril` folder inside of it. It will also add an entry under `dependencies` in the `package.json` file
@ -148,7 +148,7 @@ npm start
Now that you have created a bundle, you can then reference the `bin/app.js` file from an HTML file:
```markup
```html
<html>
<head>
<title>Hello world</title>
@ -220,7 +220,7 @@ Live reload is a feature where code changes automatically trigger the page to re
```bash
# 1) install
npm install mithril@next --save
npm install mithril --save
npm install budo -g
# 2) add this line into the scripts section in package.json
@ -255,13 +255,13 @@ If you want to try it and give feedback, you can open `package.json` and change
If you don't have the ability to run a bundler script due to company security policies, there's an options to not use a module system at all:
```markup
```html
<html>
<head>
<title>Hello world</title>
</head>
<body>
<script src="https://unpkg.com/mithril@next/mithril.js"></script>
<script src="https://unpkg.com/mithril/mithril.js"></script>
<script src="index.js"></script>
</body>
</html>

View file

@ -6,7 +6,7 @@ Let's develop a simple application that shows off how to do most of the major th
First let's create an entry point for the application. Create a file `index.html`:
```markup
```html
<!doctype html>
<html>
<head>
@ -217,7 +217,7 @@ The `m.mount` call renders the specified component (`UserList`) into a DOM eleme
Right now, the list looks rather plain because we have not defined any styles. So let's add a few of them. Let's first create a file called `styles.css` and include it in the `index.html` file:
```markup
```html
<!doctype html>
<html>
<head>

View file

@ -45,8 +45,8 @@ var Stream = require("mithril/stream")
You can also download the module directly if your environment does not support a bundling toolchain:
```markup
<script src="https://unpkg.com/mithril@next/stream/stream.js"></script>
```html
<script src="https://unpkg.com/mithril/stream/stream.js"></script>
```
When loaded directly with a `<script>` tag (rather than required), the stream library will be exposed as `window.m.stream`. If `window.m` is already defined (e.g. because you also use the main Mithril script), it will attach itself to the existing object. Otherwise it creates a new `window.m`. If you want to use streams in conjunction with Mithril as raw script tags, you should include Mithril in your page before `mithril/stream`, because `mithril` will otherwise overwrite the `window.m` object defined by `mithril/stream`. This is not a concern when the libraries are consumed as CommonJS modules (using `require(...)`).

View file

@ -121,7 +121,7 @@ One common way to misuse `m.trust` is when working with third party services who
Here's the example snippet for the [Facebook Like button](https://developers.facebook.com/docs/plugins/like-button):
```markup
```html
<!-- Load Facebook SDK for JavaScript -->
<div id="fb-root"></div>
<script>(function(d, s, id) {