Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(984)

Unified Diff: Source/devtools/front_end/documentation/DocumentationView.js

Issue 530003002: DevTools: [Documentation] Add syntax highlight for code examples (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@iliia-patch
Patch Set: Fix documentation for RegExp methods Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/devtools/front_end/documentation/DocumentationView.js
diff --git a/Source/devtools/front_end/documentation/DocumentationView.js b/Source/devtools/front_end/documentation/DocumentationView.js
index 83bf923c636577c67cc82fd433ac1fd728ad8761..32047adf9cc199c8ce834111be79d41ce4e05b60 100644
--- a/Source/devtools/front_end/documentation/DocumentationView.js
+++ b/Source/devtools/front_end/documentation/DocumentationView.js
@@ -27,6 +27,11 @@ WebInspector.DocumentationView.showDocumentationURL = function(url, searchItem)
view._revealTermDocument(url, searchItem);
}
+WebInspector.DocumentationView._languageToMimeType = {
+ "JavaScript": "text/javascript",
+ "HTML": "text/html"
+}
lushnikov 2014/09/03 15:10:25 semicolon
semeny 2014/09/03 15:34:27 Done.
+
WebInspector.DocumentationView.prototype = {
/**
* @param {string} url
@@ -208,6 +213,8 @@ WebInspector.DocumentationView.Renderer.prototype = {
var code = example.createChild("div", "documentation-example-code");
code.classList.add("source-code");
code.textContent = examples[i].code;
+ var syntaxHighlighter = new WebInspector.DOMSyntaxHighlighter(WebInspector.DocumentationView._languageToMimeType[examples[i].language], true);
lushnikov 2014/09/03 15:10:25 what if they pass JAVASCRIPT in there? this gonna
semeny 2014/09/03 15:34:27 Done.
+ syntaxHighlighter.syntaxHighlightNode(code);
}
},

Powered by Google App Engine
This is Rietveld 408576698