-
Notifications
You must be signed in to change notification settings - Fork 394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add functionality to link arbitrary strings in code blocks #1576
Conversation
currently the only usage is `dvc.yaml`, but this addition should be able to support any auto-linking rules we want in the future, even complex ones.
An example of this working can be found here, (or rather, the first instance of "dvc.yaml" after that heading) |
let's run some script to remove already existing links? @jorgeorpinel could you please provide a list of things to link? (@rogermparent @jorgeorpinel it can be sone as a separate ticket, feel free to merge this one PR then) |
I can ripgrep for |
@rogermparent sounds good to me, let's start with that |
This commit provided to you by ripgrep and emacs
Just pushed a commit that "unwraps" all links that contain |
(Originally from #1431) From what I understand, there's three currently proposed entries for the automatic linker
|
@jorgeorpinel could you please review and share the list related to the DVC files? |
It seems like "import stage" and "orphan stage" aren't used in code blocks like the current linker checks for, but I could add additional functionality to operate on italic and bold text in the same way if we want these terms auto-linked but not in code quotes.
|
Sorry, just noticed this.
Or maybe all to just /doc/user-guide/dvc-files-and-directories ? Don't worry about "orphan/import stgae" — we're not using those terms anymore.
Yes, this is needed, but for all |
No problem!
I can definitely do these!
That's up to preference, no difference either way.
Sure!
Considering I've already done it for dvc.yaml, I think it's fine to do this with the rest to introduce the feature.
Correct, currently the auto-linker specifically checks individual MDAST nodes. This works for us because code blocks are always their own individual nodes, even when inline. To capture words around the block, like file in " |
I say we just do BTW maybe we could also add |
Here's what we've got in this PR new auto-linked terms:
also
terms must be surrounded in code quotes (backticks) to be recognized by the auto-linker. Terms with parts that aren't code-quoted (like " |
Unless there's an unexpected regression or we think of something else to add, I think we're ready to merge this PR! |
to the data source (as explained in the description above). (This import stage | ||
can later be used to [update](/doc/command-reference/update) the import.) Check | ||
`data.xml.dvc`: | ||
but it also creates an import stage (`.dvc` file) with a link to the data source |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for self: replace all these "import stage" term instances in a separate PR.
thanks @rogermparent and @jorgeorpinel ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I was just waiting for https://dvc-landing-new-auto-li-fwr1dg.herokuapp.com/ to deploy for a sanity check, and it looks good.
I also actually reviewed every change and left a couple minimal suggestions, but approving this now!
When you add a file or a stage to your pipeline, DVC creates a special `.dvc` or | ||
`dvc.yaml` file (respectively) that contains all the needed information to track |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you add a file or a stage to your pipeline, DVC creates a special `.dvc` or | |
`dvc.yaml` file (respectively) that contains all the needed information to track | |
When you add a stage or a file to your pipeline, DVC creates a special `dvc.yaml` | |
or `.dvc` file (respectively) that contains all the needed information to track |
@@ -0,0 +1,14 @@ | |||
module.exports = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be extracted to a simple JSON or YAML config file so we can easily edit the list later? I mean... It's already easy but would be even easier 🙂
Also, should a test be written for this fn?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could, but using .js
allows us to use RegExp literal matchers and dynamic replacement values in a future. It's possible to switch to JSON by simply converting what's there now if we decide we don't want those features.
currently the only usage is
dvc.yaml
, but this addition to the remark plugin is able to handle any matchers, simple to complex. If we find the need for generating urls based on content I can add it, but since it isn't necessary for the currently requested additional links it can be a low priority concern.Fixes #1431