DavidWells / DavidWells/markdown-magic

Feature Request: Comment range

Open
#54 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
868
Forks
223
PR merge metrics
No merged PRs in 30d

Description

Currently the code injection allows you to specify lines of code from a file:

 <!-- AUTO-GENERATED-CONTENT:START (CODE:src=./relative/path/to/code.js&lines=22-44) -->
 This content will be dynamically replaced with code from the file lines 22 through 44
 <!-- AUTO-GENERATED-CONTENT:END -->

This can be dificult to maintain as line numbers are subject to change with API changes. An easier way to do this would be to select between specified comment blocks. Here's a simple example:

 <!-- AUTO-GENERATED-CONTENT:START (CODE:src=./relative/path/to/code.js&block=BLOCK1) -->
 This content will be dynamically replaced with code (from the file) found between comments containing "BLOCK1".
 <!-- AUTO-GENERATED-CONTENT:END -->

code.js :

// ...

// <BLOCK1>
console.log("This will get selected");
// </BLOCK1>

Happy to help out with a PR.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the code-injection handling that currently supports the lines option, then inspect how source ranges are parsed and extracted. Use the example code.js block markers as the expected input; done means a block selector can replace the line-range selector and extracts the content between matching markers.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.