Skip to content

Try to make MD generation robust #5884

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

Open
wants to merge 3 commits into
base: development
Choose a base branch
from

Conversation

boutinb
Copy link
Contributor

@boutinb boutinb commented May 9, 2025

Sub items that do not have labels or info, should be set at the same level as their parents. For this, the hierarchy of the items should be kept, before generating the MD string.

Comment on lines 66 to 82
typedef struct MDItem
{
bool isSection = false;
QString label,
info;
std::vector<struct MDItem> children;

MDItem() {}
MDItem(const QString& _label) : label{_label} {}

bool isEmpty() { return label.isEmpty() && info.isEmpty() && children.size() == 0; }
bool hasHeader() { return !label.isEmpty() || !info.isEmpty(); }

QString print(int depth = 0) const;


} MDItem;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? Please why?

@boutinb boutinb force-pushed the helpMoreBeautiful branch from 5d7e1cb to d4a7a4a Compare May 16, 2025 09:43
@boutinb
Copy link
Contributor Author

boutinb commented May 16, 2025

I have removed the MDItems structure.
In fact just a vector of JASPControl _MDSubItems is enough to define the hierarchy of the controls used for markdown generated help.
This _MDSubItems is first set correctly, then it makes much easier to generate the markdown help.

@boutinb boutinb force-pushed the helpMoreBeautiful branch from 9e16efa to 9a61545 Compare May 19, 2025 15:10

void JASPControl::setMDSubItems()
{
_MDSubItems.clear();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont like this at all...

Why do we need this function?
You can just do this determination in the generateMDHelp function...
Or let this return a list of JASPControl*

But why store it?
Then we need to think about when to update it...

Copy link
Contributor

@JorisGoosen JorisGoosen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_MDSubItems should not exist.

The function that determines this should just return std::vector<JASPControl*> and not store anything.

boutinb added 3 commits May 21, 2025 17:25
Sub items that do not have labels or info, should be set at the same level as their parents.
For this, the hierarchy of the items should be kept, before generating the MD string.
@boutinb boutinb force-pushed the helpMoreBeautiful branch from 9a61545 to 2d769b3 Compare May 21, 2025 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants