Merge pull request #346 from projektir/playpen_no_html

Creating markdown code from playpen files instead of HTML #345
This commit is contained in:
Mathieu David 2017-06-21 16:46:05 +02:00 committed by GitHub
commit c186d72b40
1 changed files with 6 additions and 1 deletions

View File

@ -36,7 +36,12 @@ pub fn render_playpen(s: &str, path: &Path) -> String {
continue;
};
let replacement = String::new() + "<pre><code class=\"language-rust\">" + &file_content + "</code></pre>";
let mut editable = "";
if playpen.editable {
editable = ",editable";
}
let replacement = String::new() + "``` rust" + editable + "\n" + &file_content + "\n```\n";
replaced.push_str(&s[previous_end_index..playpen.start_index]);
replaced.push_str(&replacement);