Skip to content

Respect markup comment in non-ruby files#1613

Closed
Earlopain wants to merge 1 commit intoruby:masterfrom
Earlopain:c-markup-commment
Closed

Respect markup comment in non-ruby files#1613
Earlopain wants to merge 1 commit intoruby:masterfrom
Earlopain:c-markup-commment

Conversation

@Earlopain
Copy link
Contributor

Fixes #1597

Prism uses markdown for documentation. In the prism repo itself we can set rdoc.markup = "markdown" but that doesn't work in ruby/ruby. So I wanted to add the markup directive to the C files that are currently missing them. But it is not respected.

@Earlopain Earlopain requested a deployment to fork-preview-protection February 16, 2026 11:17 — with GitHub Actions Waiting

return unless markup
if markup
return RDoc::Parser::Ruby if markup == "tomdoc"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There doesn't seem to be a tomdoc parser. So I kept this for backwards compatibility.

selected
else
selected = RDoc::Parser.can_parse_by_name(file_path)
return if selected == RDoc::Parser::Simple
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one has an empty regexp and would match on any file. This breaks shebang detection, so I explicitly exclude it here.

@Earlopain
Copy link
Contributor Author

It doesn't look like I know what I'm doing. markup is used to control both the parser and markup format and I have no idea what to do about that.

@Earlopain Earlopain closed this Feb 16, 2026
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.

RDoc parses .c file as ruby code if markup is set to markdown in the first 3 lines

1 participant

Comments