6
$\begingroup$

This is way over my pay-grade, so I have no idea where to start. I'm certain MMA has some very good internet capabilities, so it seems to me that it is possible.

This is really a 2-part question:

  1. How might one go about creating a Hyperlink function, by simply inputting a Symbol as an argument that takes you to the documentation page?

  2. Is there a way of checking that the page actually exists before creating the link so that the link doesn't take you to an error page?

For example, finding and opening the main page for Column and Frame with the browser. If not possible, is it still possible to do this by opening MMA's own built-in documentation?

$\endgroup$
5
  • 3
    $\begingroup$ In Mathematica each built-in symbol has a tooltip that links to the documentation. Alternatively, highlight the symbol and press F1 for help. $\endgroup$
    – Bob Hanlon
    Nov 22, 2022 at 4:01
  • $\begingroup$ I made a function that searches for Mathematica functions in text and provides a list of links for each function it found. That is what I used to make the links here for example. $\endgroup$ Nov 22, 2022 at 10:33
  • $\begingroup$ the code takes "example" as an input which is a copy pasted string (if a popup appears when pasting the string between "" say yes). $\endgroup$ Nov 22, 2022 at 10:34
  • 1
    $\begingroup$ notations = "@" | "//" | "/@" | "@@" | "@@@" | "@*" | "/*"; StringJoin["[", #, "]", "(https://reference.wolfram.com/language/ref/", #, ".html)"] & /@ Select[example // TextWords // Map[StringSplit[#, notations] &] // Flatten // DeleteDuplicates, (NameQ["System" <> #] && Not[NumericQ[ToExpression@#]] &)] // TraditionalForm` $\endgroup$ Nov 22, 2022 at 10:35
  • $\begingroup$ The only case where I saw it did not work was with formal names like \[FormalX] $\endgroup$ Nov 22, 2022 at 10:55

1 Answer 1

7
$\begingroup$

If the symbol can be found in Names, two links are created: one each for local and online documentation. For some System names, a link may not always be present but it is rare. If the symbol is not readily found, a search button is generated for the input string that leads to a search page at the Wolfram site.

s = "Part"
If[MemberQ[Names["System`*"], s]
 , RowBox[{Hyperlink[Button["Local"], "paclet:ref/" <> s]
    , Hyperlink[Button["Online"], 
     "https://reference.wolfram.com/language/ref/" <> s <> ".html"]
    }] // DisplayForm
 , Hyperlink[Button["Search"], 
  "https://search.wolfram.com/?q=" <> s <> "&skip="]
 ]

You can experiment with this and turn it into a function as you see fit.

$\endgroup$
3
  • 1
    $\begingroup$ thank you so much this is perfect $\endgroup$ Nov 22, 2022 at 6:48
  • 1
    $\begingroup$ Thanks for the accept. In addition, you can check out the URLResponseTime function for situations where a website is taking longer than expected to repond. Regards. $\endgroup$
    – Syed
    Nov 22, 2022 at 6:50
  • $\begingroup$ Very nice. OP might also want to consider NameQ for example NameQ["Part"]. NameQ also evaluates to True for formal characters like \[FormalX] and strangely \[Mu] but not other Greek letters like \[Beta] $\endgroup$ Nov 22, 2022 at 10:51

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.