From b33ef9382f1d1d88382817a1f6c339c30e6785b9 Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Wed, 15 Jan 2020 17:25:59 +0100 Subject: [PATCH] feat(developer): add button to show parsed structure (#2345) --- CHANGES.md | 6 +++++- tools/developer.html | 28 ++++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 7096ef2964..7e3e82de81 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -20,11 +20,15 @@ Language Improvements: - (vbnet) add nameof operator to the keywords (#2329) [Youssef Victor][] - (stan) updated with improved coverage of language keywords and patterns. (#1829) [Jeffrey Arnold][] +Developer Tools: + +- feat(developer): add button to show parsed structure (#2345) [Nils Knappmeier][] + [Jeffrey Arnold]: https://github.com/jrnold [Josh Goebel]: https://github.com/yyyc514 [Philipp Engel]: https://github.com/interkosmos [Youssef Victor]: https://github.com/Youssef1313 - +[Nils Knappmeier]: https://github.com/nknapp ## Version 9.17.1 diff --git a/tools/developer.html b/tools/developer.html index 4cac503782..b975a6d8ef 100644 --- a/tools/developer.html +++ b/tools/developer.html @@ -26,6 +26,24 @@ .hljs-debug { color: red; font-weight: bold; } + + .visible-structure pre code span { + display: block; + padding: 0.5em; + margin: 0.5em; + border: 1px dashed black; + position: relative; + white-space: pre; + } + + .visible-structure pre code span:before { + display: block; + content: attr(class); + color: black; + font-size: 70%; + float:right; + margin-top: -0.5em; + } @@ -35,7 +53,8 @@

highlight.js developer

- + + Language:

@@ -61,7 +80,7 @@

highlight.js developer

select.append(''); }); - $('.editor button').click(function(e) { + $('.editor button#update-highlighting').click(function(e) { var editor = $(this).parents('.editor'); var language = editor.find('.languages').val(); var source = editor.find('textarea').val(); @@ -78,6 +97,11 @@

highlight.js developer

editor.find('output').text(result.value); SourceStore.save(source, language); }); + + $('.editor button#show-structure').click(function(e) { + var editor = $(this).parents('.editor'); + editor.toggleClass('visible-structure'); + }); }); var SourceStore;