Skip to content

04. Create a blog post

Scott J edited this page Sep 15, 2019 · 18 revisions

Type into the terminal and hit ENTER:

new post

Then follow the on-screen instructions - you'll be asked to enter:

  • title
  • description
  • time to read
  • category
  • tags

Other values, such as author, will be inherited from the site defaults.

To add a permalink or override the default site info (such as layout, author, email, language, JS deps), run:

new post -all

Creating the post body

Type your markdown into the text editor, then save and exit. Your page will be built for you.

Adding dynamic content to your Markdown!

A unique feature of mdsh is that you can embed sub-shells in your Markdown by using the tag <?bash ... ;?>

This is very useful - the final output file(s) will contain the results of the sub-shell commands.

For example, when writing your new post, you can write:

<?bash uname ;?>

And (if you are using Linux) the final output file(s) will contain:

Linux

You can also do:

<?bash
cmd1
cmd2
;?>

and

<?bash cmd1; cmd2 ;?>

To include much more complex dynamic output, you could do something like:

<?bash bash path/to/script.sh ;?>

or

<?bash python path/to/script.py ;?>

^ doing it this way, makes it really easy to embed the output of Shell, Python, Ruby (etc) commands in your Markdown!

Building the HTML page

After you finish writing your post, it'll be automatically converted to valid Markdown, and then converted into an HTML file.