Commit cb9c169d authored by Ivanq's avatar Ivanq

Show markdown rendered in /file view

parent 4eb9caf6
......@@ -35,6 +35,10 @@
white-space: pre;
overflow: auto;
}
.file-content.markdown {
font-family: Arial;
white-space: normal;
}
.edit {
display: none;
......
......@@ -121,6 +121,7 @@
<script type="text/javascript" src="../../js/issues.js"></script>
<script type="text/javascript" src="../js/path_common.js"></script>
<script type="text/javascript" src="../js/common.js"></script>
<script type="text/javascript" src="../../marked/marked.js"></script>
<script type="text/javascript" src="../../hljs/highlight.min.js"></script>
<script type="text/javascript" src="js/main.js"></script>
<script type="text/javascript" src="../../js/root.js"></script>
......
......@@ -57,6 +57,15 @@ repo.addMerger()
return repo.getFile(head, path)
.then(blob => {
let fileContent = document.getElementById("file_content");
// Maybe this is a markdown file?
if(path.endsWith(".md") || path.endsWith(".markdown")) {
fileContent.classList.add("markdown");
fileContent.innerHTML = repo.renderMarked(repo.vcs.decodeUTF8(blob));
return;
}
fileContent.textContent = repo.vcs.decodeUTF8(blob);
hljs.highlightBlock(fileContent);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment