Skip to content

[Feature Request] Support start and end tags for embedding snippets of code #48

Open
@srnagar

Description

@srnagar

I have been using this tool and find it very useful to ensure our documentation is updated every time code changes. Most of the documentation requires only a small snippet from the source file and for which we are currently using line numbers.
The challenge with line numbers is if there are multiple snippets in the same source file, updating one snippet may cause the line numbers of all other snippets to change requiring a lot of effort to update the line numbers in markdown files.

One proposal to solve this is by having start and end tags for code sections that should be embedded. So, as new lines are added or removed, the tags will keep the code snippets in tact.

For e.g.

In source file (Java)

// embedme_start: tag-name
code snippet to be embedded
// embedme_end: tag-name

In markdown file:

<!-- embedme /path/to/source/file/Sample.java#tag-name -->

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions