Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Settings

Zhuochun edited this page Nov 28, 2020 · 8 revisions

Basic Settings

A basic set of settings are available in Settings page: cmd-, -> Packages -> Markdown-Writer -> Settings.

If you do not see any settings (due to a Atom's bug), please activate Markdown-Writer using command (e.g. Open Cheat Sheet). Then close and reopen the Settings page.

Refer to Settings for Front Matters on how to configure URLs to categories/posts/tags definitions.

Advance Settings

Markdown-Writer provides additional set of customisations (full list) to overwrite the default behaviours.

Apply Settings Globally

Go to menu Atom -> Config..., find or add "markdown-writer": key and append the configurations under it.

"*": # the first line you see in config.cson
  "...": # other plugins installed
  "markdown-writer":
    siteEngine: "jekyll" # add any additional configurations here, with indentation

Apply settings to Specific Projects

Open your project in Atom, trigger command Markdown Writer: Create Project Configs. This will create a _mdwriter.cson file under your project/blog root, with all the default settings.

Edit any settings, then run command Window: Reload or use menu: View -> Developer -> Reload Window to source the changes.

If you want to fallback some settings to your global configs, remember to delete those settings.

Read this config file for an example.

Example Customization

Change Front Matter

'markdown-writer':
  'frontMatter': """
layout: "custom-layout"
title: "<title>"
date: "<date>"
---
  """

Use * instead _ for Italic Style

'markdown-writer':
  'textStyles':
    'italic': 'before': "*", 'after': "*"

Use Octopress Image Tag

'markdown-writer':
  'imageTag': "{% img <align> <src> <width> <height> '{alt}' %}"

Use Different Unordered List Styles

To enable different unordered list styles at different indentation, E.g.

- Indentation 0
  * Indentation 1
    + Indentation 2

Add config:

'markdown-writer':
  templateVariables:
    ulBullet0: "-" # indentation = 0
    ulBullet1: "*" # indentation = 1
    ulBullet2: "+" # indentation = 2

Use Ordered List Styles

To use unordered list styles at the second indentation, E.g.

1. Indentation 0
   - Indentation 1

Add config:

'markdown-writer':
  templateVariables:
    olBullet1: "-"

Use same ordered list

To use 1. as the ordered list style, E.g.

1. First Point
1. Second Point
1. Third Point

1. The default is auto-increment
2. You can use command `Correct Ordered List Numbers`
3. To correct the numbers

Add config:

'markdown-writer':
  # use 1. when press enter
  orderedNewLineNumberContinuation: false
  # use 1. when change a list to ordered list
  lineStyles:
    ol:
      before: "1. "
      regexMatchBefore: "(?:\\d+[\\.\\)]|[a-zA-Z]+[\\.\\)])\\s"
      regexBefore: "(?:-|\\*|\\+|\\.|\\d+[\\.\\)]|[a-zA-Z]+[\\.\\)])\\s"

Change Image Directory

Put under current file's directory/images/file-name/*.jpg

'markdown-writer':
  siteImagesDir: "{directory}/images/{slug}/"

Support Hugo Academic Theme Structure

Refer to issue. Use config:

'markdown-writer':
  sitePostsDir: "posts/"
  newPostFileName: "{slug}/index.md"
  siteImagesDir: "{directory}/assets/"