简体   繁体   English

如何缩进反应代码块中的代码片段字符串?

[英]How can I give indentation to string of code snippet in react-code-blocks?

I am using "react-code-blocks" package from npm , In that I am trying to give indentation to code of string, Which I want to pass in "react-code-blocks".我正在使用来自 npm 的“react-code-blocks” package ,因为我试图对字符串代码进行缩进,我想将其传递给“react-code-blocks”。

String Which i was passing我正在传递的字符串

code:代码:

interface Shape {
          double getArea();
          default String getDescription() {
              return "This is a shape with an area of " + getArea();
          }
      }

And It Show as,它显示为, ` `

Now, Question Is how can I give indentation or format this string of code snippet.现在,问题是如何缩进或格式化这串代码片段。

Unfortunately you can't.不幸的是你不能。 You should be using indent string of code.您应该使用缩进代码字符串。 You can use any online beautifier or prettier for this purpose为此,您可以使用任何在线美化器或更漂亮的工具

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM