Skip to content

Commit

Permalink
Updates per request
Browse files Browse the repository at this point in the history
- When Vue.js is detected, markdown `<script>` is not executed when executeScript is `false` (matches previous behavior)
- Minor code tweaks that do not affect functonality
  • Loading branch information
jhildenbiddle committed Jul 6, 2020
1 parent dd88248 commit 105fbbf
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/core/render/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ function renderMain(html) {
!this.config.loadSidebar && this._renderSidebar();

// Execute markdown <script>
if (this.config.executeScript || 'Vue' in window) {
if (
this.config.executeScript ||
('Vue' in window && this.config.executeScript !== false)
) {
executeScript();
}

Expand All @@ -62,15 +65,13 @@ function renderMain(html) {

for (let i = 0, len = childElms.length; i < len; i++) {
const elm = childElms[i];
const isValid = ['SCRIPT'].indexOf(elm.tagName) === -1;
const isValid = elm.tagName !== 'SCRIPT';
const isVue = Boolean(elm.__vue__ && elm.__vue__._isVue);

if (isValid && !isVue) {
new window.Vue({
mounted: function() {
if (this.$children.length === 0) {
this.$destroy;
}
this.$destroy;
},
}).$mount(elm);
}
Expand Down

0 comments on commit 105fbbf

Please sign in to comment.