Generate help centers for your iOS apps, with Markdown

Overview

SupportDocs Logo

SupportDocs Header

Generate help centers for your iOS apps, with Markdown!

All you need to do is write your documents on GitHub, and install the library in your app. SupportDocs' custom GitHub Action and GitHub Pages will take care of the rest.

Table of Contents

How It Works

  1. Write documents in Markdown, on GitHub
  2. GitHub Pages will convert them into HTML and host it for free
  3. A custom GitHub Action will generate a JSON data source for you
  4. The SupportDocs library will download the JSON and display it to your users!

How It Works - Graphic

The SupportDocs library is written in SwiftUI, so it's only for iOS 13 and above.

Installation

Installing SupportDocs takes two steps:

  1. Set up the GitHub repository where you write and host your documents
  2. Install the library inside your app

Set Up the GitHub Repository

This will be where you write your documents. GitHub Pages will translate your Markdown into HTML, and a custom GitHub Action will automatically compile the web pages into a JSON file.

  1. Scroll up to the top of this page and click Use this template
  2. Enter a repository name -- this can be whatever you want
  3. Make sure it's set to Public (If you are using the free version of GitHub, GitHub Pages only works for public repos)
  4. Make sure to check Include all branches. This is really important.
  5. Click Create repository from template
  6. In your brand new repository, click the Settings tab
  7. Scroll down to the GitHub Pages section, and select DataSource branch and / (root) folder. Then click Save.
  8. That's it for the GitHub repository! Now time to install the library in your app.

Install the Library

This is the actual interface that your users will see. You can install using CocoaPods or Swift Package Manager, whichever one you prefer.

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To install SupportDocs into your Xcode project using CocoaPods, add it in your Podfile:

pod 'SupportDocs'

Swift Package Manager

The Swift Package Manager is built into Xcode, which makes it really easy to use.

  1. Go to your project settings
  2. Click your project
  3. Switch to the Swift Packages tab
  4. Click the + button
  5. Enter https://github.com/aheze/SupportDocs in the text field
  6. Click Next
  7. Enter the latest version, 1.1.0, in the text field. Leave Up to Next Major selected.
  8. Click Next
  9. Click Finish, and you're done!

Example Project

Check out the example project in the Example folder! It contains a playground where you can play around with how SupportDocs is displayed.

Example project home page Example project options page Press the "Present" button to display the library

Usage

SupportDocs is pretty simple to use, with two parts: the GitHub repository and the library in your app.

The GitHub repository is where you add and edit your documents using Markdown. This is online, so you can edit at any time and always show the latest information to your users. All your documents are compiled into a single JSON file, the URL of which you'll pass into the library. The library is what's displayed to your users, in your app. All it needs is the URL of the JSON file, and you can either use SwiftUI or UIKit to embed it.

Show Extended Documentation

Using the GitHub Repository

In you brand new repository that you set up earlier, switch to the DataSource branch. The example documents are inside the Sample-Boba, Sample-FastFood, and Sample-Smoothies folders -- take a look around. Here's a guide:

Show guide

  • .github/workflows is for the GitHub Action, for compiling your documents into JSON
  • Images contains the images used in the example documents
  • Sample-Boba contains all documents tagged with boba
  • Sample-FastFood contains all documents tagged with fastFood
  • Sample-Smoothies contains all documents tagged with smoothies
  • _data contains the generated data source URL
  • _layouts is for GitHub Pages to convert your Markdown into HTML
  • _sass is where you can customize the look of the HTML, including light and dark mode colors
  • _scripts contains the script used by the GitHub Action, as well as the README template. This template is what you should edit if you want to change the README at all -- if you change it directly, your changes will be overriden.
  • assets/css applies the _sass
  • .gitignore is for git to ignore unnecessary files
  • 404.md is the 404 document that will be displayed if your URLs are wrong. You can also pass this into options.other.error404 in case your data source URL fails.
  • README.md is for your reference. It contains a link to the data source URL, and a table of contents that shows all your documents. Do not edit this file directly -- instead, edit the file in _scripts/README.md.
  • _config.yml sets the default theme, "Primer," for GitHub Pages. We recommend that you don't change this, as we customized dark mode specifically for the "Primer" theme -- you'll need to configure assets/css/main.scss if you use your own theme.

Documents can be placed in the root directory or a subfolder. However, we recommmend that you use folders to organize your documents. In the example,

  • Documents tagged with boba are in the Sample-Boba folder
  • Documents tagged with fastFood are in the Sample-FastFood folder
  • Documents tagged with smoothies are in the Sample-Smoothies folder

Adding and Editing Documents

  • To add a document, click the Create new file button.
  • If you want to add it to a folder, navigate to the folder first and then click the Create new file button.
    • If you want to create a new folder, click Create new file -- then, in the filename, first put the folder name, then a slash (/), followed by the filename (Example: fastFood/Burgers.md). Read more here.
Add a Document Add a Document in the Sample-Boba Subfolder
Root Directory "Create new file" Subfolder "Create new file"

Then, to make the document eligible for SupportDocs, you must fulfill these criteria:

  • The document extension must end in .md
  • At the top of the document (this is called the front matter), you need to fill in the title. We strongly suggest you add tags too.
---
title: Buy blue boba
tags: boba
---

Example File With Front Matter Highlighted

The title is what will be displayed in each row of the list, in the SupportDocs library. Once you select a row, it's also what's shown as the title of the navigation bar.

Title in Library List Title in Navigation Bar

Everything after the --- of the front matter is your document's content. You use Markdown to write your documents.

Markdown Result          
---
title: Buy blue boba
tags: boba
---

# Buy blue boba

Blue and yummy. Buy this at [google.com](https://google.com)

1. Eat
2. Eat
3. Eat
4. Eat
5. Eat

![Blue Boba Image](https://raw.githubusercontent.com/aheze/SupportDocs/DataSource/Images/blueBoba.jpg)

Tagging Documents

With tags, you get a lot of control over what to display in the library. To add tags, just fill in the tags, underneath the title. For example, check out this example document in the DataSource branch.

---
title: Buy blue boba
tags: boba
---

This document has the tag boba. As you might assume, there are other documents in the DataSource branch also tagged with boba.

Here is a graphic which shows the documents, titles, and tags in the DataSource branch.

Documents with Front Matter

Once your documents have tags, you can choose to show which documents to show and which ones to hide, in the library. This is covered in the Categories section of the library customization documentation.


Using the Library

The library is the view that you embed in your app, and what the user sees. But before you present it, you need to get the data source URL first! Go to your brand-new repo's DataSource branch, scroll down to the README, and copy the URL.

Data Source URL Location

The custom GitHub Action generated this URL for you, so keep it safe!

Now you can present the view in your app. You can use SwiftUI or UIKit, and here's the least code that you need to write for it to work.

SwiftUI

import SwiftUI
import SupportDocs

struct SwiftUIExampleViewMinimalCode: View {
    let dataSource = URL(string: "https://raw.githubusercontent.com/aheze/MyHelpCenter/DataSource/_data/supportdocs_datasource.json")!
    @State var supportDocsPresented = false
    
    var body: some View {
        Button("Present SupportDocs from SwiftUI!") { supportDocsPresented = true }
        .sheet(isPresented: $supportDocsPresented, content: {
            SupportDocsView(dataSourceURL: dataSource, isPresented: $supportDocsPresented)
        })
    }
}

UIKit

import UIKit
import SupportDocs

class UIKitExampleControllerMinimalCode: UIViewController {
    
    /**
     Connect this inside the storyboard.
     
     This is just for demo purposes, so it's not connected yet.
     */
    @IBAction func presentButtonPressed(_ sender: Any) {
        
        let dataSource = URL(string: "https://raw.githubusercontent.com/aheze/MyHelpCenter/DataSource/_data/supportdocs_datasource.json")!
        
        let supportDocsViewController = SupportDocsViewController(dataSourceURL: dataSource)
        self.present(supportDocsViewController, animated: true, completion: nil)
    }
}

Result

Result Graphic

Now that you have the library set up and working, you can hop on over to the library customization section and customize SupportDocs to your liking. Perhaps add a "Dismiss" button or only show documents with specific tags.


Customization

You get a lot of control over what to display.

  • Document Rendering: How your Markdown should be rendered. Customize colors and add your own HTML if you want!
  • Library: The basic navigation that's displayed to the user. Customize pretty much anything, from categories to the navigation bar color.
Document Rendering Library
Document rendering graphic Library options graphic

Authors

SupportDocs is a project maintained by A. Zheng and H. Kamran.

License

MIT License

Copyright (c) 2021 A. Zheng and H. Kamran

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Notes

Example repo

You can find an example repository generated from SupportDocs here.

Data collection

SupportDocs does not collect any data. We provide this note to help you fill out your App Privacy Details.

Testing on Apple Silicon / Big Sur

On my MacBook Pro M1 running Big Sur 11.0.1, I get a crash when loading the web page on iOS 13 simulators. It works fine for iOS 14, and the crash doesn't happen at all when I run on my Intel Mac. I'm pretty sure that this won't be a problem for actual devices, but keep in mind that you might run into some issues during testing. Apple is still polishing up Big Sur.

Dark Mode

SupportDocs supports Dark Mode right out of the box! You don't need to do anything.

Dark Mode Graphic

You might also like...
Swift markdown library
Swift markdown library

Markdown ![Swift version](https://img.shields.io/badge/Swift-2.1 | 2.2-blue.svg) ![GitHub license](https://img.shields.io/badge/license-LGPL v3-green.

A Pure Swift implementation of the markdown mark-up language

SmarkDown A pure Swift markdown implementation consistent with Gruber's 1.0.1 version. It is released under the BSD license so please feel free to use

`resultBuilder` support for `swift-markdown`

SwiftMarkdownBuilder resultBuilder support for swift-markdown. The default way to build Markdown in swift-markdown is to use varargs initializers, e.g

Leverages Apple's Swift-based Markdown parser to output NSAttributedString.
Leverages Apple's Swift-based Markdown parser to output NSAttributedString.

Markdownosaur 🦖 Markdownosaur uses Apple's excellent and relatively new Swift Markdown library to analyze a Markdown source, and then takes that anal

AttributedString Markdown initializer with custom styling
AttributedString Markdown initializer with custom styling

AttributedString Markdown initializer with custom styling AttributedString in iOS 15 and macOS 12 comes with a Markdown initializer. But: There is no

An Objective-C framework for converting Markdown to HTML.

MMMarkdown MMMarkdown is an Objective-C framework for converting Markdown to HTML. It is compatible with OS X 10.7+, iOS 8.0+, tvOS, and watchOS. Unli

Converts Markdown files and strings into NSAttributedStrings with lots of customisation options.
Converts Markdown files and strings into NSAttributedStrings with lots of customisation options.

SwiftyMarkdown 1.0 SwiftyMarkdown converts Markdown files and strings into NSAttributedStrings using sensible defaults and a Swift-style syntax. It us

Blazing fast Markdown / CommonMark rendering in Swift, built upon cmark.
Blazing fast Markdown / CommonMark rendering in Swift, built upon cmark.

Down Blazing fast Markdown (CommonMark) rendering in Swift, built upon cmark v0.29.0. Is your app using it? Let us know! If you're looking for iwasrob

A Github action for creating generic run report using Markdown
A Github action for creating generic run report using Markdown

create-report A Github action for creating generic run report (using Markdown!) - uses: michaelhenry/[email protected] with: report-title: "

Owner
Peter Salz
Peter Salz
Notepad - A fully themeable iOS markdown editor with live syntax highlighting.

Notepad is just like any other UITextView, but you need to use the convenience initializer in order to use the themes. To create a new theme, copy one of the existing themes and edit the JSON.

Rudd Fawcett 802 Dec 31, 2022
Markdown parser for iOS

Marky Mark Marky Mark is a parser written in Swift that converts markdown into native views. The way it looks it highly customizable and the supported

M2mobi 254 Jun 11, 2021
Markdown syntax highlighter for iOS

Marklight Markdown syntax highlighter for iOS and macOS. Description Marklight is a drop in component to easily add realtime Markdown syntax highlight

Matteo Gavagnin 539 Dec 29, 2022
Rich Markdown editing control for iOS

MarkdownTextView Rich Markdown Editing for iOS MarkdownTextView is an iOS framework for adding rich Markdown editing capabilities. Support for Markdow

Indragie Karunaratne 676 Dec 7, 2022
Markdown parsing and rendering for iOS and OS X

CocoaMarkdown Markdown parsing and rendering for iOS and macOS CocoaMarkdown is a cross-platform framework for parsing and rendering Markdown, built o

Indragie Karunaratne 1.2k Dec 12, 2022
Markdown parser for iOS

Marky Mark Marky Mark is a parser written in Swift that converts markdown into native views. The way it looks it highly customizable and the supported

M2mobi 262 Nov 23, 2021
A simple and customizable Markdown Parser for Swift

MarkdownKit MarkdownKit is a customizable and extensible Markdown parser for iOS and macOS. It supports many of the standard Markdown elements through

Bruno Oliveira 687 Dec 18, 2022
MarkdownView is a WKWebView based UI element, and internally use bootstrap, highlight.js, markdown-it.

MarkdownView is a WKWebView based UI element, and internally use bootstrap, highlight.js, markdown-it.

Keita Oouchi 1.8k Dec 21, 2022
Marky Mark is a parser written in Swift that converts markdown into native views.

Marky Mark is a parser written in Swift that converts markdown into native views. The way it looks it highly customizable and the supported markdown syntax is easy to extend.

M2mobi 287 Nov 29, 2022
Markdown in SwiftUI, and some other interesting components.

RoomTime RoomTime is a bundle of tools developed in my app RoomTime Lite. ( ?? RoomTime Lite is still in development) Features TextArea AutoWrap Markd

Chen SiWei 56 Dec 20, 2022