This repository has been archived on 2024-10-29. You can view files and clone it, but cannot push or open issues or pull requests.
FunctionProject/scripts/execute-function/convertMarkdown_DOM.js

13 lines
589 B
JavaScript

$(function () {
if (localStorage.getItem('convertedHTML') && localStorage.getItem('texteMarkdown')) {
$('.results').html(localStorage.getItem('convertedHTML'));
$('#texteMarkdown').val(localStorage.getItem('texteMarkdown'));
}
$("#texteMarkdown").bind("keyup change", () => {
const textMarkdown = $('#texteMarkdown').val();
const convertedHTML = marked(textMarkdown);
localStorage.setItem("convertedHTML", convertedHTML);
localStorage.setItem("texteMarkdown", textMarkdown);
$('.results').html(convertedHTML);
});
});