Getting published markup to work correctly
显示 更早的评论
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 个评论
Rik
2023-8-17
Did you check the F1-text for builtin functions? If I recall correctly, those have this same 'limited' layout.
Chuck Noise
2023-8-17
Chuck Noise
2023-8-17
编辑:Chuck Noise
2023-8-17
Rik
2023-8-17
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.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Scripts 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

