/g, ">").replace(/"/g, """); }
function inline(s) {
return esc(s)
.replace(/`([^`]+)`/g, "$1")
.replace(/\*\*([^*]+)\*\*/g, "$1")
.replace(/(^|[^*])\*([^*\s][^*]*)\*/g, "$1$2")
.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g, function (_, t, href) {
var ext = /^https?:/.test(href);
return '" + t + "";
});
}
function slug(s) { return s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, ""); }
function render(md, articleId) {
var lines = md.replace(/\r/g, "").split("\n");
var out = [], toc = [], i = 0, intro = [], inIntro = true;
function push(html) { (inIntro ? intro : out).push(html); }
function para(buf) { if (buf.length) push("
" + inline(buf.join(" ")) + "
"); }
while (i < lines.length) {
var line = lines[i];
if (!line.trim()) { i++; continue; }
var m;
if ((m = /^##\s+(.*)$/.exec(line)) && !/^###/.test(line)) {
inIntro = false;
var id = articleId + "--" + slug(m[1]);
toc.push({ id: id, text: m[1] });
out.push('
' + inline(m[1]) + "
");
i++; continue;
}
if ((m = /^###\s+(.*)$/.exec(line))) {
var qas = [];
while (i < lines.length && (m = /^###\s+(.*)$/.exec(lines[i]))) {
i++;
var ans = [], buf = [];
while (i < lines.length && !/^#{2,3}\s/.test(lines[i])) {
if (!lines[i].trim()) { if (buf.length) { ans.push("
");
continue;
}
if (/^\d+\.\s/.test(line)) {
var items = [];
while (i < lines.length && (m = /^(\d+)\.\s+(.*)$/.exec(lines[i]))) {
var num = m[1], title = m[2].replace(/^\*\*(.*)\*\*$/, "$1"), body = [];
i++;
while (i < lines.length && /^\s{2,}\S/.test(lines[i])) { body.push(lines[i].trim()); i++; }
while (i < lines.length && !lines[i].trim() && i + 1 < lines.length && /^\s{2,}\S/.test(lines[i + 1])) { i++; body.push(""); while (i < lines.length && /^\s{2,}\S/.test(lines[i])) { body.push(lines[i].trim()); i++; } }
var paras = body.join("\n").split(/\n\n+/).filter(Boolean).map(function (p) { return "
" + inline(p.replace(/\n/g, " ")) + "
"; }).join("");
items.push('
' + num + '
' + inline(title) + '
' + paras + "
");
while (i < lines.length && !lines[i].trim()) i++;
}
push('' + items.join("") + "");
continue;
}
if (/^[-*]\s/.test(line)) {
var lis = [];
while (i < lines.length && /^[-*]\s/.test(lines[i])) {
var t = lines[i].replace(/^[-*]\s+/, ""); i++;
while (i < lines.length && /^\s{2,}\S/.test(lines[i])) { t += " " + lines[i].trim(); i++; }
lis.push("
" + inline(t) + "
");
}
push('
' + lis.join("") + "
");
continue;
}
if (/^>\s?/.test(line)) {
var q = [];
while (i < lines.length && /^>\s?/.test(lines[i])) { q.push(lines[i].replace(/^>\s?/, "")); i++; }
push('
' + inline(q.join(" ")) + "
");
continue;
}
var buf2 = [];
while (i < lines.length && lines[i].trim() && !/^(#{2,3}\s|\d+\.\s|[-*]\s|>)/.test(lines[i])) { buf2.push(lines[i].trim()); i++; }
para(buf2);
}
return { intro: intro.join(""), body: out.join(""), toc: toc };
}
// ---- Views ----
var view = document.getElementById("view");
var nav = document.querySelector(".side nav");
var ICON_OPEN = '';
var ICON_SEARCH = '';
function buildNav(current) {
var html = 'All help topics';
sections.forEach(function (s) {
html += "
";
}
function showHome() {
document.title = "FeeWaiver.app Help";
var html = '
How to use FeeWaiver.app
' +
'
Step-by-step guides for advisers, from uploading bank statements to exporting the evidence bundle. Search for what you want to do, or pick a topic below.