0
Not a bug

Custom template not showing up in template list

Jake Rayson 7 years ago in iPhone updated 6 years ago 3

I followed the instructions for creating a custom template on Textastic 6.4.1 on an iPhone 6 10.3.3. It's a Markdown template for my static site generator, using Front Matter, in a file called fm.json. It is saved in a folder in Local Files called #Textastic/Templates


However, after restarting Textastic, the template isn't appearing in the list :(


Any ideas why? Many thanks, Jake


{
  "uuid": "E3435C11-14CF-4DE6-A0D8-EE5ADC2F0D5C",
  "category": "Markdown",
  "templates": [
    {
      "name": "Frontmatter",
      "fileExtension": "md",
      "snippet": "---
title:
date: DATE
layout: post.hbs
collections: posts
draft: true
desc:  
---
"
    }
  ]
}

Image 227


GOOD, I'M SATISFIED
Satisfaction mark by Jake Rayson 6 years ago
Not a bug

JSON does not support multi-line strings. You need to escape new line characters with \n and tab characters with \t.


You can use a JSON validator like https://jsonlint.com to check whether it is a valid JSON file.


This works:


{
  "uuid": "E3435C11-14CF-4DE6-A0D8-EE5ADC2F0D5C",
  "category": "Markdown",
  "templates": [
    {
      "name": "Frontmatter",
      "fileExtension": "md",
      "snippet": "---\ntitle: ${1:untitled}\ndate: DATE\nlayout: post.hbs\ncollections: posts\ndraft: true\ndesc: $2\n---\n"
    }
  ]
}

I've also added tab stops, so that you can enter a title after creating a file with this template and hit tab to jump to the description field.

aargh, I wasn't thinking JSON! Thank you :)

As a sidenote for anyone looking, I had to manually enter JSON as copying and pasting didn't work. Probably to do with errant character in my original snippet.