コード例 #1
0
ファイル: guide_code_viewer.js プロジェクト: Jaaess/kibana
  componentDidUpdate() {
    if (this.refs.html) {
      hljs.highlightBlock(this.refs.html);
    }

    if (this.refs.javascript) {
      hljs.highlightBlock(this.refs.javascript);
    }
  }
コード例 #2
0
				[].slice.call(mut.addedNodes).forEach(function(el) {

					// Ignore unless added element is a PRE > CODE
					el = (el.tagName === 'PRE' && el.querySelector('code')) || el;
					if (el.tagName === 'CODE' && el.parentNode.tagName === 'PRE') {
						hljs.highlightBlock(el);
					}
				});
コード例 #3
0
ファイル: index.js プロジェクト: mafintosh/docker-registry-ui
  }, function(err, response) {
    if (err) return onerror(err)

    var $code = document.querySelector('#code-view code')
    $code.className = 'hljs'
    $code.innerHTML = response.body
    highlight.highlightBlock($code)
  })
コード例 #4
0
ファイル: app.js プロジェクト: ecliptik/goldfish
 targets.forEach((target) => {
   // if a value is directly assigned to the directive, use this
   // instead of the element content.
   if (binding.value) {
     target.textContent = binding.value
   }
   hljs.highlightBlock(target)
 })
コード例 #5
0
                setTimeout(() => {
                    if (this._unmounted) return;
                    for (let i = 0; i < blocks.length; i++) {
                        if (SettingsStore.getValue("enableSyntaxHighlightLanguageDetection")) {
                            highlight.highlightBlock(blocks[i]);
                        } else {
                            // Only syntax highlight if there's a class starting with language-
                            const classes = blocks[i].className.split(/\s+/).filter(function(cl) {
                                return cl.startsWith('language-');
                            });

                            if (classes.length != 0) {
                                highlight.highlightBlock(blocks[i]);
                            }
                        }
                    }
                }, 10);
コード例 #6
0
 requestAnimationFrame(() => {
   const node = findDOMNode(this);
   const codeBlocks = node.getElementsByTagName('pre');
   for (let i = 0; i < codeBlocks.length; i++) {
     const codeBlock = codeBlocks[i];
     hljs.highlightBlock(codeBlock.firstChild);
   }
 });
コード例 #7
0
ファイル: index.js プロジェクト: yanagiis/raml-documentation
 _highlightCode() {
   let domNode = ReactDOM.findDOMNode(this);
   let nodes = domNode.querySelectorAll('pre code');
   if (nodes.length > 0) {
     for (let i = 0; i < nodes.length; i=i+1) {
       hljs.highlightBlock(nodes[i]);
     }
   }
 }
コード例 #8
0
ファイル: index.js プロジェクト: Imms/imms.github.io
 highlightCode: function highlightCode() {
   var domNode = ReactDOM.findDOMNode(this);
   var nodes = domNode.querySelectorAll('pre code');
   if (nodes.length > 0) {
     for (var i = 0; i < nodes.length; i = i + 1) {
       hljs.highlightBlock(nodes[i]);
     }
   }
 },
コード例 #9
0
async function processHighlight (node) {
	console.log('processHighlight');
	var codes = node.querySelectorAll('pre.code');
	for (var i = 0, it; (it = codes[i]); i++) {
		if (/lang-(\S+)/.test(it.className)) {
			console.log('highlightBlock', it);
			hljs.highlightBlock(it);
		}
	}
	return node;
}
コード例 #10
0
ファイル: code.js プロジェクト: vorons/vorons.github.io
export function highlightCodeBlocks() {
  let blocks = document.querySelectorAll('pre code[class*="language-"]');

  // For local development.
  if (window.location.port == 4000) {
    blocks = document.querySelectorAll('pre code');
  }

  for (let i = 0; i < blocks.length; i++) {
    hljs.highlightBlock(blocks[i]);
  }
}
コード例 #11
0
		window[callbackName] = function(content) {

			// Extract just the prettyprint bit, which can then use techdocs standard styling
			content = content.replace(/^[\s\S]*(<pre [^>]*>)([\s\S]*?<\/pre>)[\s\S]*$/, "<pre><code>$2");
			content = content.replace(/<\/pre>$/, "</code></pre>");

			el.innerHTML = content;
			window[callbackName] = undefined;

			// Re-run highlighter so that the new content is highlighted
			hljs.highlightBlock(el.querySelector('code'));
		};
コード例 #12
0
ファイル: pdf.js プロジェクト: JetBrains/kotlin-web-site
 $('.sample').each((ind, element) => {
   const codeElement = $(element).find('code')[0];
   let code = codeElement.textContent;
   const startIndex = code.indexOf(SAMPLE_START);
   const endIndex = code.indexOf(SAMPLE_END);
   if (startIndex > -1 && endIndex > -1) {
     code = code.substring(code.indexOf(SAMPLE_START) + SAMPLE_START.length + 1);
     code = code.substring(0, code.indexOf(SAMPLE_END));
     if (!code.charAt(0).trim()) code = code.split('\n').map(l => l.substring(4)).join("\n")
   }
   codeElement.textContent = code;
   hljs.highlightBlock(codeElement);
 });
コード例 #13
0
ファイル: main.js プロジェクト: zyb-ui/zyb-ui-ele
  componentUpdated: function componentUpdated(el) {
    // after an update, re-fill the content and then highlight
    var targets = el.querySelectorAll('code');
    var target;
    var i;

    for (i = 0; i < targets.length; i += 1) {
      target = targets[i];
      // if (typeof binding.value === 'string') {
      //   target.textContent = binding.value;
      hljs.highlightBlock(target);
      // }
    }
  }
コード例 #14
0
ファイル: main.js プロジェクト: rooc/scraper
			function(data, textStatus, jqXHR) {
				toastr.info(jqXHR.status, "jqXHR.status");
				toastr.info(textStatus, "textStatus");
				var content = $(data.results[0]);
				loader.clean();
				if(content.find(selector).length) {
					var rawhtml = htmlcleaner(content.find(selector)[0].outerHTML);
				} else {
					toastr.error("I don't think that your selector is real", 'Inconceivable!')
				}
				$('#outhtml>code').text(rawhtml);
				hljs.highlightBlock($('#outhtml>code')[0]);
				htmlTree(rawhtml);
			},
コード例 #15
0
ファイル: main.js プロジェクト: zyb-ui/zyb-ui-ele
  bind: function bind(el, binding) {
    // on first bind, highlight all targets
    var targets = el.querySelectorAll('code');
    var target;
    var i;

    for (i = 0; i < targets.length; i += 1) {
      target = targets[i];

      if (typeof binding.value === 'string') {
        // if a value is directly assigned to the directive, use this
        // instead of the element content.
        target.textContent = binding.value;
      }

      hljs.highlightBlock(target);
    }
  },
コード例 #16
0
ファイル: highlight.js プロジェクト: SirPepe/Pik9
 $('[pikHighlight]').map((idx, el) => {
   var $contents;
   var $el = $(el);
   var lang = $el.attr('pikHighlight') || '';
   if($el.is('code')){
     $el.addClass('language-' + lang);
     hljs.highlightBlock($el.get(0));
   } else if($el.is('pre')){
     $contents = $el.contents().detach();
     var $wrapper = $('<code>')
       .addClass('language-' + lang)
       .appendTo($el);
     $contents.appendTo($wrapper);
   } else {
     $contents = $el.contents().detach();
     var $wrapperPre = $('<pre>').appendTo($el);
     var $wrapperCode = $('<code>')
       .addClass('language-' + lang)
       .appendTo($wrapperPre);
     $contents.appendTo($wrapperCode);
   }
 });
コード例 #17
0
 componentDidMount: function() {
   Utils.mountJsBin();
   hljs.highlightBlock(this.refs.code1.getDOMNode());
   hljs.highlightBlock(this.refs.code2.getDOMNode());
 },
コード例 #18
0
ファイル: Code.js プロジェクト: ariesw/belle
 componentDidUpdate() {
   highlightJs.highlightBlock(ReactDOM.findDOMNode(this));
 }
コード例 #19
0
ファイル: Code.js プロジェクト: ariesw/belle
 componentDidMount() {
   highlightJs.highlightBlock(ReactDOM.findDOMNode(this));
 }
コード例 #20
0
ファイル: app.js プロジェクト: ecliptik/goldfish
 targets.forEach((target) => {
   if (binding.value) {
     target.textContent = binding.value
     hljs.highlightBlock(target)
   }
 })
コード例 #21
0
 Array.prototype.forEach.call(codeBlocks, function (code) {
   highlight.highlightBlock(code)
 })
コード例 #22
0
 highlight () {
   let node = document.querySelector('[data-highlight-id="' + this.props._id + '"] code.example-code')
   if (node) {
     hljs.highlightBlock(node)
   }
 }
コード例 #23
0
ファイル: CodeHighLight.js プロジェクト: andbet39/reactPress
 const xxx = jQuery('pre').each((inde, block) => {
   hljs.highlightBlock(block);
 });
コード例 #24
0
ファイル: index.js プロジェクト: Elkrival/google-maps-react
const routes = (
  <Router createElement={createElement}
          history={hashHistory}>
    <Route component={Container}
           path='/'>
      {Object.keys(routeMap).map(key => {
        const r = routeMap[key]
        return (<Route
                key={key}
                path={key}
                name={r.name}
                component={r.component} />)
      })}
      <IndexRoute component={routeMap['basic'].component} />
    </Route>
  </Router>
)

const mountNode = document.querySelector('#root')
if (mountNode) {
  ReactDOM.render(routes, mountNode);
} else {
  const hljs = require('highlight.js');

  const codes = document.querySelectorAll('pre code');
  for (var i = 0; i < codes.length; i++) {
    const block = codes[i]
    hljs.highlightBlock(block);
  }
}
コード例 #25
0
ファイル: index.js プロジェクト: 12eeeeee/insightpresentation
			content.find("pre").each(function() {
				hljs.highlightBlock(this);
			});
コード例 #26
0
ファイル: Highlight.js プロジェクト: DINNERMENU/storybook
 nodes.forEach(node => {
   hljs.highlightBlock(node);
 });
コード例 #27
0
ファイル: author_view.js プロジェクト: virtUOS/courseware
        if (!jQuery('section .block-content button[name=save]').length) {
            return;
        }
        if (event.isUserInputHandled) {
            return;
        }
        event.isUserInputHandled = true;
        Backbone.trigger('preventnavigateto', !confirm('Es gibt nicht gespeicherte Änderungen. Möchten Sie die Seite trotzdem verlassen?'));
    },

    render() {
        return this;
    },

    postRender() {
        hljs.highlightBlock(this.$('.code-content-preview > pre > code')[0]);
    },
    
    updatePreview() {
        var $code_content = this.escapeHtml(this.$('textarea').val());
        var $code_lang = this.$(".code_lang").val();
        var $preview_block = this.$('.code-content-preview > pre > code');
        $preview_block.html($code_content);
        if ($code_lang !== "") {
            $preview_block.removeAttr('class');
            $preview_block.addClass("hljs");
            $preview_block.addClass($code_lang);
        } else {
            var $classes = $preview_block.attr('class').split(/\s+/);
            if ($classes.length > 1) {
                this.$(".code_lang").val($classes[1]);
コード例 #28
0
 didInsertElement: function(){
   Highlight.highlightBlock(this.get('element'));
 },
コード例 #29
0
ファイル: entry.js プロジェクト: anran02/starter-kit
 $('pre code').each(function(i, block) {
   hljs.highlightBlock(block);
 });
コード例 #30
0
ファイル: index.js プロジェクト: auth0/styleguide
 document.querySelectorAll('pre.hl code').forEach(block => hljs.highlightBlock(block));