3

Simple settings for writing and converting markdown with Sublime Text

 1 year ago
source link: https://benfrain.com/markdown-settings-for-sublime-text/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Simple settings for writing and converting markdown with Sublime Text

03.08.2023 0 comments
2 days since last revision. Content should be accurate.

Prettify your markdown

There are dedicated markdown packages, but if you write in Sublime, here are some very simple tweaks you can make to get a lovely centered column, in the width of your choosing with spell checking enabled.

Open a markdown (*.md) file, and go ‘Settings > Settings – Syntax Specific’ and you will be presented with a dual file panel with and empty JSON on one side. Here is what I add to mine:

// These settings override both User and Default settings for the Markdown syntax
{
  
  "wrap_width": 80,
  "draw_centered": true,
  "spell_check": true,
},

Hopefully they are all pretty self explanatory – with those in place you get a nice centered layout that wraps at 80 columns (amend width to suit) with spell check enabled.

Screengrab of Sublime Text interface
With just a few tweaks you can have a very respectable looking markdown experience

Converting your markup

Again, there are dedicated packages to simplify converting your markdown with Pandoc. However, if you want something mean and lean, you can make yourself a simple build script.

Assuming you have Pandoc installed, from the Sublime menu, Tools > Build System > New Build System.

You’ll be greeted with a blank JSON file, add the following:

{
  "shell_cmd": "pandoc \"${file}\" --no-highlight --wrap=none | pbcopy",
  "working_dir": "${file_path}",
    "selector": "text.html.markdown"
}

Now, when you have written your markdown file, and want it converting, you can just use cmd+b to ‘build’ it and get the file converted and copied to your clipboard.

You may well want to tweak the pandoc command to your preference but it should be whatever you would use on the command line to run Pandoc. The only point of note is that you will need the \"${file}\" part in there. That is what tells the build system to use the contents of the file you are working on as the file that gets sent to the command.

If you enjoyed this post and/or it was useful, Say thanks with a coffee. 🙏

Video Course Ultimate Text Editing Productivity with Sublime Text

Master the incredible power and hidden features of Sublime Text

Prettify your markdownConverting your markup


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK