Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

extend functionality of Code Snippets Import #612

Copy link
Copy link
Closed
@tk1

Description

@tk1
Issue body actions

Feature request

It would be very convenient

  1. to import only a few lines of a file
  2. to specify the begin and end of the region to be imported by regular expressions
  3. to specify the lines to be highlighted by a regular expression

What problem does this feature solve?

If a file is big and only a few lines are interesting to demonstrate an idea, you could extract those lines easily.

When using regular expressions, you don't need to count line numbers and change them when inserting lines into the file. You could write regular expressions which match certain code lines or comments, e.g. /* start-snip */.

What does the proposed API look like?

<<< @/filepath{from=reFrom, to=reTo, inclusive=[yes|no], highlight=reHighlight}

where reXXX are regular expressions. Then the region to be extracted would start at the first match of reFrom and end at the first following match of reTo. If inclusive=yes then the matching lines are included, otherwise excluded. All the lines in the region which match reHighlight will be highlighted.

All properties should be optional:

  • If from and to are missing the whole file will be included
  • If from is given and to is missing to will be the end of the file regardless of inclusive
  • If from is missing and to is given, from will be the start of the file regardless of inclusive
  • The default value for inclusive is yes.
  • If highlight is missing, nothing is highlighted.

How should this be implemented in your opinion?

By extending the current Import Code Snippet Markdown functionality.

Are you willing to work on this yourself?**

I'm not proficient in Markdown extensions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.