4
$\begingroup$

We can easily create clickable hyperlinks for Documentation pages like the following:

{URL["paclet:ref/Set"], Hyperlink["paclet:ref/Set"]}

screenshot

But how can I resolve such an URL into the absolute path to the Documentation's Notebook?

I expected that Information can do it, but it doesn't:

Information[URL["paclet:ref/Set"], "AbsolutePath"]
"paclet:ref/Set"

Note that in version 13 the standard path to Documentation files has changed, and now by default they are located in a hidden folder in the user's profile.

$\endgroup$

1 Answer 1

4
$\begingroup$

Update: Documentation`ResolveLink

Tracing NotebookOpen[uri] with TraceInternal -> True reveals a call to Documentation`ResolveLink function which actually resolves the Documentation URIs:

Documentation`ResolveLink["paclet:ref/Set"]
"C:\\Users\\APopkov\\AppData\\Local\\Programs\\Common\\Wolfram Research\\Documentation.en-us\\13.0\\Documentation\\English\\System\\ReferencePages\\Symbols\\Set.nb"

Original answer

One working solution is to open the URI with NotebookOpen and then obtain the absolute path via NotebookFileName:

resolveNotebookPath[uri_] := 
 Module[{no = NotebookOpen[uri, Visible -> False], nfn}, 
  nfn = NotebookFileName[no]; NotebookClose[no]; nfn]

Example:

resolveNotebookPath["paclet:ref/Set"]
"C:\\Users\\APopkov\\AppData\\Local\\Programs\\Common\\Wolfram Research\\Documentation.en-us\\13.0\\Documentation\\English\\System\\ReferencePages\\Symbols\\Set.nb"

Of course, it isn't a good method since it requires actually opening the Notebook, which may take substantial system resources and is potentially dangerous.

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.