christian-bromann / docusaurus-theme-github-codeblock

A Docusaurus plugin that supports referencing code examples from public GitHub repositories.
MIT License
17 stars 5 forks source link

Feature request: highlight lines in the code #137

Closed DanRoscigno closed 5 months ago

DanRoscigno commented 5 months ago

I tried setting the label on this issue to feature, but I do not have permission to add labels.

With the default Docusaurus codeblocks I am able to add comments to codeblocks to indicate the start and stop of highlighted sections:

-- Create table from S3 using FILES() table function
CREATE TABLE DocsQA.user_behavior_inferred
AS SELECT * FROM FILES (
    "path" = "s3://starrocks-examples/user_behavior_ten_million_rows.parquet",
    "format" = "parquet",
    "aws.s3.region" = "us-east-1",
    -- highlight-start
    "aws.s3.access_key" = "AAAAAAAAAAAAAAAAAAAA",
    "aws.s3.secret_key" = "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"
    -- highlight-end
);

renders as:

image

Your code (which is wonderful and very important to me) seems to be noticing that the comments are meant to be processed but not displayed, as I do not see the comments when rendered using your package:

image
DanRoscigno commented 5 months ago

Ah! I apologize, it works fine. I forgot that I included the hash in the URL that I was referencing. I had added the highlighting comments in a newer commit. I just updated and everything is beautiful.

My use case may interest you, I am instituting a testing procedure for the documentation for the StarRocks database. I want to source code snippets from end to end tests so that I have warning when I need to update the documentation because of a breaking change.

Thanks again!

christian-bromann commented 5 months ago

Thanks for verifying. Closing.