DoIt icon indicating copy to clipboard operation
DoIt copied to clipboard

[FEATURE] Code Block Title

Open GreatestOfAllTimee opened this issue 2 years ago • 2 comments

Describe the feature you want 描述你的功能需求

I don't know if this feature already exist or not (which I already try difference method).

Example:-

```rust:main.rs
code...
```

or

````rust {title="main.rs"}
code...
```

Image below are reference what I mean by "title".

  • TOML to config.toml
  • Javascript to App.js
  • etc ...

CodeTitle

Useful reference 有价值的参考

Maybe this is a the right one, (not quite sure because I can't try this).

  • https://gohugo.io/contribute/documentation/#code-block-shortcode

GreatestOfAllTimee avatar Mar 13 '22 17:03 GreatestOfAllTimee

It is not supported yet but I think it is possible with the new 0.93.0 code block hook.

https://gohugo.io/templates/render-hooks/#render-hooks-for-code-blocks

HEIGE-PCloud avatar Mar 13 '22 18:03 HEIGE-PCloud

I don't know if this was helpful but you can try take a look - https://koki-nakamura22.github.io/blog/2019/10/02/hugo-code-block-title/#add-javascript-code

GreatestOfAllTimee avatar Mar 13 '22 18:03 GreatestOfAllTimee