Skip to content

need a copy code widget to be able to copy code snippets #2288

@stas00

Description

@stas00

Is it possible to add to https://nvidia.github.io/TensorRT-LLM/ the code copy widget that you already have on https://nvidia.github.io/TensorRT-Model-Optimizer/?
For example if you go to https://nvidia.github.io/TensorRT-Model-Optimizer/guides/_pytorch_quantization.html#apply-post-training-quantization-ptq you can copy the code

Image

But if you go to https://nvidia.github.io/TensorRT-LLM/llm-api-examples/index.html#llm-examples-introduction you can't - manual copy-n-paste results in double new lines for me.

Image

Thank you!

I think it's the way the HTML is encoded which breaks each line, because you have 2 spans per line

<span class="linenos"> 2</span>
<span class="linenos"> 3</span><span class="n">prompts</span> <span class="o">=</span> <span class="p">[</span>
<span class="linenos"> 4</span>    <span class="s2">&quot;Hello, my name is&quot;</span><span class="p">,</span>
<span class="linenos"> 5</span>    <span class="s2">&quot;The president of the United States is&quot;</span><span class="p">,</span>
<span class="linenos"> 6</span>    <span class="s2">&quot;The capital of France is&quot;</span><span class="p">,</span>
<span class="linenos"> 7</span>    <span class="s2">&quot;The future of AI is&quot;</span><span class="p">,</span>
<span class="linenos"> 8</span><span class="p">]</span>

Metadata

Metadata

Assignees

Labels

DocumentationTRTLLM's textual/illustrative materials: API refs, guides, tutorials. Improvement & clarity.feature requestNew feature or request. This includes new model, dtype, functionality supportnot a bugSome known limitation, but not a bug.staletriagedIssue has been triaged by maintainers

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions