Taffrail Advice - HTML
by taffrail
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/4.0.2/marked.min.js"></script>
<h3>
Advice in Markdown
</h3>
<p>
Rendered by <a href="https://github.com/markedjs/marked">marked</a>.
</p>
<div id="advice"></div>
CSS
html,body {
margin: .5rem;
}
JavaScript
const api = {
data: {
advice: [{
"headline": "Because your income is above $198,000, you are not eligible for a Roth IRA and should consider a Traditional IRA instead.",
"headline_markdown": "* Because [your income is above $198,000](#Income-tooRoth), you are not eligible for a Roth IRA and should consider a Traditional IRA instead."
}]
}
}
marked.setOptions({
headerPrefix: "taffrail-",
mangle: false,
smartLists: true,
smartypants: true,
silent: true
});
$("#advice").html(marked.parse(api.data.advice[0].headline_markdown));