almariah / embed-code-file

MIT License
54 stars 9 forks source link

Support GitHub Permalink #4

Open MiracleXYZ opened 2 years ago

MiracleXYZ commented 2 years ago

Thanks for the awesome plug-in, it works really well.

It would be nice to directly support GitHub permalinks, for example

https://github.com/almariah/embed-code-file/blob/458b689efb769fd0787ac897a25864e48f45ec54/main.ts#L8-L23

Which is rendered in GitHub Issue web page as

https://github.com/almariah/embed-code-file/blob/458b689efb769fd0787ac897a25864e48f45ec54/main.ts#L8-L23

This link contains several key information:

  1. Code path. The real code path should be the corresponding githubusercontent link. You could also embed a file in a certain branch or commit as well.
  2. Code language. .ts means a TypeScript code file, no need to specify.
  3. Line numbers. The trailing #L<start>-L<end> represents the line numbers to be shown.
almariah commented 2 years ago

@MiracleXYZ Thanks for your suggestion, I will work on it.

gmkado commented 1 year ago

Any progress on this? Would be awesome, especially when using with this new vscode feature https://code.visualstudio.com/updates/v1_77#_copy-github-deep-links-from-editor-gutter