Skip to content

Commit

Permalink
Prepare for v2, s/markup/html/g in code blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
dead-claudia committed Jul 23, 2019
1 parent 20f0759 commit b580e24
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 57 deletions.
81 changes: 41 additions & 40 deletions .travis.yml
Expand Up @@ -28,46 +28,47 @@ script:
- npm run perf

# After a successful build commit changes back to repo
after_success:
- |
# Set up SSH environment
$(npm bin)/set-up-ssh \
--key "$encrypted_016049456622_key" \
--iv "$encrypted_016049456622_iv" \
--path-encrypted-key "./.deploy.enc"
# Commit bundle changes generated in before_script step
# --commands is a weird no-op but required for commit-changes to run
# --branch arg is to ensure this only runs against the `next` branch
$(npm bin)/commit-changes \
--commands "echo committing" \
--commit-message "Bundled output for commit $TRAVIS_COMMIT [skip ci]" \
--branch "next"
# Only want to commit docs when building pushes on master &
# this doesn't have the built-in branch protection like commit-changes
if [ "$TRAVIS_EVENT_TYPE" == "push" ] && \
[ "$TRAVIS_BRANCH" == "master" ] && \
[ "$TRAVIS_REPO_SLUG" == "MithrilJS/mithril.js" ]
then
# Generate docs
npm run gendocs
# Set up git env
git config --global user.email "$GH_USER_EMAIL"
git config --global user.name "$GH_USER_NAME"
# Commit docs to gh-pages branch
# Using --add to ensure that archived versions aren't lost
# Using --repo to force it to go over SSH so the saved keys are used (tschaub/gh-pages#160)
$(npm bin)/gh-pages \
--dist ./dist \
--add \
--repo "git@github.com:MithrilJS/mithril.js.git" \
--message "Generated docs for commit $TRAVIS_COMMIT [skip ci]"
else
echo "Not submitting documentation updates"
fi
# Disable per https://github.com/MithrilJS/mithril.js/issues/2417
# after_success:
# - |
# # Set up SSH environment
# $(npm bin)/set-up-ssh \
# --key "$encrypted_016049456622_key" \
# --iv "$encrypted_016049456622_iv" \
# --path-encrypted-key "./.deploy.enc"
#
# # Commit bundle changes generated in before_script step
# # --commands is a weird no-op but required for commit-changes to run
# # --branch arg is to ensure this only runs against the `next` branch
# $(npm bin)/commit-changes \
# --commands "echo committing" \
# --commit-message "Bundled output for commit $TRAVIS_COMMIT [skip ci]" \
# --branch "next"
#
# # Only want to commit docs when building pushes on master &
# # this doesn't have the built-in branch protection like commit-changes
# if [ "$TRAVIS_EVENT_TYPE" == "push" ] && \
# [ "$TRAVIS_BRANCH" == "master" ] && \
# [ "$TRAVIS_REPO_SLUG" == "MithrilJS/mithril.js" ]
# then
# # Generate docs
# npm run gendocs
#
# # Set up git env
# git config --global user.email "$GH_USER_EMAIL"
# git config --global user.name "$GH_USER_NAME"
#
# # Commit docs to gh-pages branch
# # Using --add to ensure that archived versions aren't lost
# # Using --repo to force it to go over SSH so the saved keys are used (tschaub/gh-pages#160)
# $(npm bin)/gh-pages \
# --dist ./dist \
# --add \
# --repo "git@github.com:MithrilJS/mithril.js.git" \
# --message "Generated docs for commit $TRAVIS_COMMIT [skip ci]"
# else
# echo "Not submitting documentation updates"
# fi

# Environment configuration
env:
Expand Down
6 changes: 3 additions & 3 deletions docs/index.md
Expand Up @@ -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
Expand Down Expand Up @@ -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>
Expand Down
18 changes: 9 additions & 9 deletions docs/installation.md
Expand Up @@ -9,16 +9,16 @@

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>
```

---

### NPM

```bash
$ npm install mithril@next --save
$ npm install mithril --save
```

TypeScript type definitions are available from DefinitelyTyped. They can be installed with:
Expand Down Expand Up @@ -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
```

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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>
Expand Down
4 changes: 2 additions & 2 deletions docs/simple-application.md
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
4 changes: 2 additions & 2 deletions docs/stream.md
Expand Up @@ -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(...)`).
Expand Down
2 changes: 1 addition & 1 deletion docs/trust.md
Expand Up @@ -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) {
Expand Down

0 comments on commit b580e24

Please sign in to comment.