publish/marks/MarksRenderer.js
/**
     * Render the markdown template
     * @param templateId Template Id
     * @param targetSelector Target dom element selector, if not specified, document.body will be used
     */
Render the markdown template
@param templateId Template Id
@param targetSelector Target dom element selector, if not specified, document.body will be used
Render the markdown template @param templateId Template Id @param targetSelector Target dom element selector if not specified document . body will be used
renderFromHtmlNode(templateId, targetSelector) {
        var _a, _b, _c, _d;
        const _document = new Document_1.Document(this.targetRender);
        let doc = (_b = (_a = document.querySelector(templateId)) === null || _a === void 0 ? void 0 : _a.innerHTML) !== null && _b !== void 0 ? _b : "";
        var textDecoder = document.createElement("textarea");
        textDecoder.innerHTML = doc;
        doc = (_c = textDecoder.value) !== null && _c !== void 0 ? _c : "";
        const renderedDom = this.internalRender(doc, false);
        const targetRenderer = (_d = document.querySelector(targetSelector !== null && targetSelector !== void 0 ? targetSelector : "body")) !== null && _d !== void 0 ? _d : document.body;
        const scripts = renderedDom.getScripts().join("\n\n");
        let script;
        if (scripts.length) {
            script = document.createElement("script");
            script.type = "text/javascript";
            script.appendChild(document.createTextNode(renderedDom.getScripts().join("\n")));
            renderedDom.toDom().appendChild(script);
        }
        targetRenderer.appendChild(renderedDom.toDom());
        script && targetRenderer.appendChild(script);
    }
renderFromHtmlNode ( templateId , targetSelector ) { var _a , _b , _c , _d ; const _document = new Document_1 . Document ( this . targetRender ) ; let doc = ( _b = ( _a = document . querySelector ( templateId ) ) === null || _a === void 0 ? void 0 : _a . innerHTML ) !== null && _b !== void 0 ? _b : "" ; var textDecoder = document . createElement ( "textarea" ) ; textDecoder . innerHTML = doc ; doc = ( _c = textDecoder . value ) !== null && _c !== void 0 ? _c : "" ; const renderedDom = this . internalRender ( doc , false ) ; const targetRenderer = ( _d = document . querySelector ( targetSelector !== null && targetSelector !== void 0 ? targetSelector : "body" ) ) !== null && _d !== void 0 ? _d : document . body ; const scripts = renderedDom . getScripts ( ) . join ( "\n\n" ) ; let script ; if ( scripts . length ) { script = document . createElement ( "script" ) ; script . type = "text/javascript" ; script . appendChild ( document . createTextNode ( renderedDom . getScripts ( ) . join ( "\n" ) ) ) ; renderedDom . toDom ( ) . appendChild ( script ) ; } targetRenderer . appendChild ( renderedDom . toDom ( ) ) ; script && targetRenderer . appendChild ( script ) ; }
Render the markdown template
 @param templateId Template Id
 @param targetSelector Target dom element selector, if not specified, document.body will be used
Render the markdown template @param templateId Template Id @param targetSelector Target dom element selector if not specified document . body will be used