Skip to content

Instantly share code, notes, and snippets.

@sahara-ooga
Created November 26, 2017 09:18
Show Gist options
  • Save sahara-ooga/8449aad0d7ef1bdfc22b3f9922c113fc to your computer and use it in GitHub Desktop.
Save sahara-ooga/8449aad0d7ef1bdfc22b3f9922c113fc to your computer and use it in GitHub Desktop.
Have Xcode 9 render markdown

Have Xcode 9 render markdown

To make Xcode 9 render markdown file eg. README.md, drop .xcodesamplecode.plist in your .xcodeproj/ folder. .xcodesamplecode.plist is like this:

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <array/> </plist>

For convenience, There is this tool, which is derived from a tutorial.

brew install corekit/brew/renderer
cd /your/xcode/project/path
renderer

Note that while xcode 9 render option is on, you can`t edit the markdown file in Xcode 9.

@Cj370118568
Copy link

Cj370118568 commented Feb 26, 2018

it doesn't work

i turn it on.
but my md file doesn't render

@galiak11
Copy link

galiak11 commented Apr 5, 2018

This worked for me after adding the file to the <app>.xcworkspace/ folder.

@bakeddean
Copy link

Agree with @galiak11 about adding plist to the workspace (if you have one).

To Allow Editing

  • With the file selected, go to Editor > Syntax Coloring and select None
  • Select another file
  • Select the markdown file again

Switch back to rendering

  • With the file selected, go to Editor > Syntax Coloring and select Default For Filetype (should be Markdown)
  • Select another file
  • Select the markdown file again

Bit of a nuisance. Unfortunately I couldn't find any key bindings for Editor > Syntax Coloring either.

@deden
Copy link

deden commented Mar 27, 2019

The easiest way to render markdown in Xcode is by using QuickLook.

Install qlmarkdown plugin https://github.com/toland/qlmarkdown
README.md > Open as > Quick look

@Peter-Schorn
Copy link

This worked for me when adding the .xcodesamplecode.plist to my .xcodeproj/ folder. However, it didn't work when I tried to add the file to a package I created. Does anyone have any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment