假设我们有这样的记录字符串

/** retrieve a state of the service
* <br/> HTTP code 200 - normal state
* <br/> HTTP code 403 - some recoverable state:
const val SERVICE_STATE = "servicestate" */

这里有几个101,我使用它们来换行,就像我在java中所做的那样,但是AndroidStudio的输出(在InteliJIdea中看起来是一样的)是 enter image description here

用java解析它&amp;正确显示:

/** retrieve a state of the service
 * <br/> HTTP code 200 - normal state
 * <br/> HTTP code 403 - some recoverable state */
public static final String SERVICE_STATE = "servicestate";

enter image description here

Can i somehow achieve the same with kotlin & IntelijIdea, maybe kotlin has another option to break the line in KDoc?

推荐答案

The KDoc format uses Markdown syntax instead of HTML, and basic Markdown does not provide a way to break the line without starting a new paragraph.

I'm not sure why the Kotlin IntellIJ plugin does not support <br/> or the double space hack.

If starting a new paragraph is OK, just skip an empty line:

/** 
 * retrieve a state of the service
 *
 * HTTP code 200 - normal state
 *
 * HTTP code 403 - some recoverable state:
 */

结果是:

enter image description here

Kotlin相关问答推荐

使用Jackson反序列化HTML列表时出现MismatchedInputResponse

Kotlin中一个接口的实现问题

为什么不';Kotlin是否在数据类构造函数中隐式分配null值可为null的字段?

为什么可组合对象看似无状态(唯一传递的参数是函数,而不是状态),但会进行重组

在Kotlin lambda的参数中如何指定函数类型?

Gradle:无法创建 ExtensiblePolymorphicDomainObjectContainer

Jetpack Compose 中的连续重组

如何将 `throw` 放置在辅助函数中但仍然具有空安全性?

Kotlin 使用委托进行隐式覆盖

Kotlin - 覆盖方法中的 IllegalArgumentException

Kotlin 创建snackbar

Android Room - error: Cannot figure out how to save this field into database

主机名不能为空

Kotlin:什么是 kotlin.String!类型

Firestore - 如何在 Kotlin 中排除数据类对象的字段

Kotlin:如何从另一个类访问字段?

使用 Kotlin 创建自定义 Dagger 2 范围

如何在Kotlin中使方法param可变?

uses-sdk:minSdkVersion 16 不能小于库中声明的版本 23

Kotlin类型安全类型别名