hexo-kotlin-playground

2.0.1 • Public • Published

Hexo Kotlin Playground

使Hexo的CodeBlock支持Kotlin Playground

使用方法

安装
npm install hexo-kotlin-playground --save
启用插件

拷贝样例_config.yml内的内容至你的_config.yml

注意事项

  • 如果是由v1升级来的,注意用法已经不是首行注释了,而是tag,标签名为ktpg

  • 而且已经没有设置独立开关的地方了(除了总开关),要关闭就使用普通代码块

独立设置

  • 在tag参数列表里,设置在后面即可

    {% ktpg line-number=false auto-indent=4 %}
    //@playground enable line-number=false
    fun main(){
      println("Hello Kotlin")
    }
    {% endktpg %}

    支持 key | key=value | key='value' | key="value" 四种格式的设置 支持如下设置:

  • 支持使用别名来指定参数名

    如:
    version => data-version
    platform => data-target-platform
    readonly => data-highlight-only
    ...
    更多可以看SpecialConfigKey

    其他别名

  • 隐藏代码 在代码块中插入以//@hidestart,以//@hideend结尾的,即可隐藏这段代码块中间的内容 如:

    {% ktpg line-number=false auto-indent=4 %}
    fun main(){
      println(str)
    }
    //@hidestart
    val str = "Hello Kotlin"
    //@hideend
    {% endktpg %}
  • 仅显示代码 在代码块中插入以//sampleStart,以//sampleEnd结尾,即可只显示这块代码中间的内容 忽略此注释则使用代码块的none-markers属性 取消显示隐藏代码的按钮则设置代码块的属性folded-buttonfalse(folded-button=false)

    这部分和Kotlin Playground Customizing editors官方使用方法一样

Readme

Keywords

Package Sidebar

Install

npm i hexo-kotlin-playground

Weekly Downloads

2

Version

2.0.1

License

MIT

Unpacked Size

19.6 kB

Total Files

12

Last publish

Collaborators

  • kairlec