@12core/highlightjs-solidity 中文文档教程
highlight.js
Solidity 的语法定义。
有关 highlight.js 的更多信息,请参阅 https://highlightjs.org/
有关 Solidity 的更多信息,请参阅 http://solidity.readthedocs.io/
Usage
只需在您的网页中包含 highlight.js
脚本包或节点应用程序,加载此模块并将其应用于 hljs
。
如果你不使用构建系统,只是想将它嵌入到你的网页
<script type="text/javascript" src="/path/to/highlight.pack.js"></script>
<script type="text/javascript" src="/path/to/highlightjs-solidity/solidity.js"></script>
<script type="text/javascript">
hljs.registerLanguage('solidity', window.hljsDefineSolidity);
hljs.initHighlightingOnLoad();
</script>
中
var hljs = require('highlightjs');
var hljsDefineSolidity = require('highlightjs-solidity');
hljsDefineSolidity(hljs);
hljs.initHighlightingOnLoad();
Advanced
:语言不是solidity
。 如果您想这样做,只需 import { definer } from 'highlightjs-solidity';
并像这样使用它:hljs.registerLanguage('othername', definer);
。
About the author
在 http://pospi.spadgos.com 找到我 给
我一些以太币? (; <代码>0x52c04Bf91ebB58221A4ac65967e4CDa15a871eba
highlight.js
syntax definition for Solidity.
For more about highlight.js, see https://highlightjs.org/
For more about Solidity, see http://solidity.readthedocs.io/
Usage
Simply include the highlight.js
script package in your webpage or node app, load up this module and apply it to hljs
.
If you're not using a build system and just want to embed this in your webpage:
<script type="text/javascript" src="/path/to/highlight.pack.js"></script>
<script type="text/javascript" src="/path/to/highlightjs-solidity/solidity.js"></script>
<script type="text/javascript">
hljs.registerLanguage('solidity', window.hljsDefineSolidity);
hljs.initHighlightingOnLoad();
</script>
If you're using webpack / rollup / browserify / node:
var hljs = require('highlightjs');
var hljsDefineSolidity = require('highlightjs-solidity');
hljsDefineSolidity(hljs);
hljs.initHighlightingOnLoad();
Advanced
This is a pretty simple package, the only thing you might want to do differently is name the language something other than solidity
. If you want to do this, simply import { definer } from 'highlightjs-solidity';
and use it like: hljs.registerLanguage('othername', definer);
.
About the author
Find me at http://pospi.spadgos.com
Tip me some ether? (; 0x52c04Bf91ebB58221A4ac65967e4CDa15a871eba