dineshsonachalam/markdown-autodocs

Restrict the included code blocks to a given number of lines

Becheler opened this issue ยท 2 comments

I came to your repository because my previous attempt to use another repo (https://github.com/tokusumi/markdown-embed-code) failed. Markdown autodocs worked perfectly and I feel blessed ๐Ÿ‘๐Ÿฝ

However, I liked this feature on this other repo: the fact you could possibly refer to specific lines to be included using [begin-end] syntax:

\```python:tests/src/sample.py [4-5]
  
\```

Can we hope to see this feature developed any time soon?

Hi @Becheler,

This feature is already available in the markdown-autodocs for code-block.

I missed adding an optional parameter called lines for the code-block in markdown-autodocs documentation.

lines (optional): a range with lines of code which will then be replaced with code from the file. The line range should be defined as: "lines=startLine-EndLine" (for example: "lines=22-44").

Please take a look at the below example.

Before using markdown-autodocs:

image

After using markdown-autodocs:

image

Please feel to reach out to me with any questions.

Wonderful!
Thank you so much for your prompt answer! Have a wonderful weekend!