In the process of creating a pyramid web app, I am currently working on integrating the JavaScript markdown editor EpicEditor for editing markdown files.
$.ajax({
url: "{{ request.resource_url(context) }}raw_markdown",
context: document.body,
success: function(md){
markdown = md;
}
})
var opts = {
basePath: '{{ request.static_url('plcars:static/') }}',
focusOnLoad: true,
clientSideStorage: false,
autogrow: true,
file: { defaultContent: markdown }
};
var editor = new EpicEditor(opts);
editor.load();
However, after implementing EpicEditor, it appears that markdown
is not being recognized correctly. Even when using alert(markdown)
, it shows up empty and document.write(markdown);
does not display anything.
The URL in the ajax call is functioning properly, as confirmed by the successful request shown in the Firefox web console. When checking the value of the markdown variable in the console, it shows the expected content (e.g., "This is my text"
).
Prior to this issue, I had attempted to pass the markdown data through a JSON container which seemed to work fine except for the inability to display the string on the page.