Getting published markup to work correctly

5 vues (au cours des 30 derniers jours)
Chuck Noise
Chuck Noise le 17 Août 2023
Commenté : Chuck Noise le 29 Août 2023
Hi
I am trying to make some good looking help texts for a bunch of functions. I am trying out the publish option, which I never used before, and I am having a bit of troubles with it.
I made a test function (test_f.m) to get acquainted with the publishing function. Firstly, I just copy/pasted an example from the Publishing Markup documentation from mathworks (https://se.mathworks.com/help/matlab/matlab_prog/marking-up-matlab-comments-for-publishing.html):
%% Vector Operations
% You can perform a number of binary operations on vectors.
%%
A = 1:3;
B = 4:6;
%% Dot Product
% A dot product of two vectors yields a scalar.
% MATLAB has a simple command for dot products.
s = dot(A,B);
%% Cross Product
% A cross product of two vectors yields a third
% vector perpendicular to both original vectors.
% Again, MATLAB has a simple command for cross products.
v = cross(A,B);
And then I published it to see how it worked. Now after publishing, if I type help test_f in the command window or hover over the test_f and press f1 I get this:
Which doesn't look good at all.
If I follow the link for showdemo_test_f a new window is opened:
Which shows the help text just as I want it.
My question is whether it is possible to get this correctly looking help text to be displayed when you use f1 amd similarly get something more that 2 lines and a hyperlink when using help test_f?
EDIT:
I just have an additional question: Are you ment to make a seperate .m file for the help text or could you have both the help text and the actual code for the function in the same .m file?
Thanks
  4 commentaires
Chuck Noise
Chuck Noise le 17 Août 2023
Modifié(e) : Chuck Noise le 17 Août 2023
In all fairness it doesn't really change that much whether I get the right look of the help text or not, but I just like when it looks good :)
In looking for tutorials about making publishing markup I found almost nothing so it seems that it's not something other people really worry about
Rik
Rik le 17 Août 2023
Generating nice documentation for functions seems to be a fairly niche wish. I primarily use the publish function to generate documentation for my FEX submissions, but I generate an m-file from components I wrote to do that.
I hope Mathworks is working on a way to make it easier to write a function in such a way that you can integrate nice-looking documentation and the tab completion in the m-file itself.
I never use that smaller popup myself because it is so small, so if you've read the documentation and did a google search, I don't think there is much I can do for you.

Connectez-vous pour commenter.

Réponse acceptée

Divyanshu
Divyanshu le 29 Août 2023
Hi Chuck,
I understand the issue you are facing; you can go through the following explanation:
  • The difference in the views is because when we use Publish a proper formatted HTML page is rendered in the web-browser. On the other hand, when we use ‘helpcommand for the same function it uses a plain-text format to display the information.
  • For built-in functions like optimoptions information is displayed in proper UI when hovered over and pressed F1, because separate HTML pages are created for each of such functions.
However, if you want to get similar UI then you can make use of ‘publish’ function which can be called directly from your MATLAB script.
For more details about ‘publish’ function of MATLAB refer the following documentation:

Plus de réponses (0)

Catégories

En savoir plus sur Characters and Strings dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by