The following customization can be applied to Manuscript to enable Custom Fields of the “Long Text” type to support Markdown.

Please see this article for more details and how to install Customizations on your Manuscript site.

name: Markdown in Long Text Custom Fields
description: Automatically converts Markdown entered into custom fields with the long text type
author: Rob Zimmerman
version: 1.0.0.0

js:

var MarkdownInLongText = (function() {
 var init = function() {
 loadShowdownJs();
 }

var loadShowdownJs = function () {
 var showdownScript = document.createElement('script');
 showdownScript.setAttribute('src','https://cdnjs.cloudflare.com/ajax/libs/showdown/1.8.5/showdown.min.js');
 document.head.appendChild(showdownScript);

showdownScript.addEventListener('load', function() {
 initMarkdownConverting();
 });
 }

var initMarkdownConverting = function () {
 var convertLongTextsToMarkdown = function () {
 var converter = new showdown.Converter();
 var longtexts = $(".customfield-longtext .content");

var convertToMarkdown = function () {
 var customField = $(this);
 var markdown = customField.html().replace("<pre>", "").replace("</pre>", "").trim();
 var newHtml = converter.makeHtml(markdown);
 customField.html(newHtml);
 };

longtexts.each(convertToMarkdown);
 };

// Do conversions after navigating to a case
 fb.pubsub.subscribe({
 "/nav/end": function (event) {
 if (typeof fb.cases.current.sAction != "undefined") {
 convertLongTextsToMarkdown();
 }
 }
 });

// Just in case we hit a race condition
 setTimeout(convertLongTextsToMarkdown(), 500);
 }

return {
 init: init
 };
})();

MarkdownInLongText.init();

css:

/* None Needed */