diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/src/main.rs b/src/main.rs index ffa6486..2cd3a5d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -523,27 +523,9 @@ fn render_markdown(input: &str, page: &mut Page, _mode: RenderMode) { page.body.push_str("</div>"); } -fn embed_html_as_iframe(input: &str, page: &mut Page, mode: RenderMode) { - if mode == RenderMode::View { - page.body.push_str("<iframe src='?action=run'></iframe>"); - page.frame_src = Some("'self'"); - } else { - page.body - .push_str("<div class=note>Note that JavaScript does not work in the preview.</div>"); - // sandbox=allow-scripts wouldn't work because the strict parent page CSP still applies - - // The sandbox attribute makes browsers treat the embedded page as a unique origin. - page.body.push_str(&format!( - "<iframe srcdoc='{}' sandbox></iframe>", - html_escape(input) - )); - } -} - fn get_renderer(path: &Utf8Path) -> Option<fn(&str, &mut Page, RenderMode)> { match path.extension() { Some("md") => Some(render_markdown), - Some("html") => Some(embed_html_as_iframe), _ => None, } } |