YARD没有用code替换' code '是正常的吗?

时间:2022-09-01 08:07:54

I'm just starting to use YARD for documenting my Rails app. I didn't specify any specific Markup handler, but I would have expected that `code` would be converted to code, which doesn't seem to happen. Is this normal behavior? Do I have to add some additional option to make this work? Thank you.

我刚刚开始使用YARD来记录我的Rails应用程序。我没有指定任何特定的标记处理程序,但我本以为“代码”会被转换成代码,这似乎不会发生。这是正常行为吗?我是否需要添加一些额外的选项来让这个工作?谢谢你!

3 个解决方案

#1


17  

The syntax is a little different from markdown (markdown vs rdoc) I suppose. Using '+' works. +code+ gets rendered in a <code> block.

语法与markdown (markdown vs . rdoc)有点不同。使用“+”作品。+code+在块中呈现。

#2


16  

From GitHub, I was used to use backticks for inline code comments. So after some research I found the following, very nice solution.

从GitHub上,我习惯了在内联代码注释中使用反勾号。经过一些研究,我找到了下面的,非常好的解决方案。

  • Add the redcarpet gem to your Gemfile
  • 将红地毯宝石添加到你的宝石文件中
  • Run bundle command
  • 运行包命令
  • Add --markup=markdown to your .yardopts file
  • 添加—标记=标记到.yardopts文件中
  • Start YARD server using yard server --reload
  • 使用码服务器启动码服务器——重新加载
  • Open localhost:8808 in your browser
  • 在浏览器中打开localhost:8808

Now you can use Syntax like on GitHub, e.g.

现在你可以使用类似GitHub上的语法。

```ruby
def bla; puts 'bla'; end
```

Or

`this is inline code`

Nice! :)

好了!:)

#3


6  

Without markdown, YARD will display a code block for an indented line, e.g.

如果没有markdown, YARD将显示一个缩进行的代码块,例如。

  # This is a useful POSIX regex:
  #   [[:lower:]]{2}[[:digit:]]{3}[[:lower:]]{2}[[:digit:]]{4}

Two spaces of indent seem to be sufficient.

缩进的两个空格似乎足够了。

#1


17  

The syntax is a little different from markdown (markdown vs rdoc) I suppose. Using '+' works. +code+ gets rendered in a <code> block.

语法与markdown (markdown vs . rdoc)有点不同。使用“+”作品。+code+在块中呈现。

#2


16  

From GitHub, I was used to use backticks for inline code comments. So after some research I found the following, very nice solution.

从GitHub上,我习惯了在内联代码注释中使用反勾号。经过一些研究,我找到了下面的,非常好的解决方案。

  • Add the redcarpet gem to your Gemfile
  • 将红地毯宝石添加到你的宝石文件中
  • Run bundle command
  • 运行包命令
  • Add --markup=markdown to your .yardopts file
  • 添加—标记=标记到.yardopts文件中
  • Start YARD server using yard server --reload
  • 使用码服务器启动码服务器——重新加载
  • Open localhost:8808 in your browser
  • 在浏览器中打开localhost:8808

Now you can use Syntax like on GitHub, e.g.

现在你可以使用类似GitHub上的语法。

```ruby
def bla; puts 'bla'; end
```

Or

`this is inline code`

Nice! :)

好了!:)

#3


6  

Without markdown, YARD will display a code block for an indented line, e.g.

如果没有markdown, YARD将显示一个缩进行的代码块,例如。

  # This is a useful POSIX regex:
  #   [[:lower:]]{2}[[:digit:]]{3}[[:lower:]]{2}[[:digit:]]{4}

Two spaces of indent seem to be sufficient.

缩进的两个空格似乎足够了。