From 39d863def55fa73811b1384516405f6ad82822b5 Mon Sep 17 00:00:00 2001 From: Earlopain <14981592+Earlopain@users.noreply.github.com> Date: Mon, 16 Feb 2026 15:43:10 +0100 Subject: [PATCH] Fix C extension docs in ruby/ruby Because ruby/ruby doesn't use our rake task it also uses the default markup (rdoc), unless specified otherwise. github.com/ruby/prism/pull/3572 already added it explicitly to ruby files. For C however, it is not so easy because of a rdoc bug: https://github.com/ruby/rdoc/issues/1597 Adding the comment would remove all documentation since it gets parsed as ruby. So, specify it for each method individually. Remove it from the template since there is only one C file relevant for rdoc. --- ext/prism/extension.c | 20 ++++++++++++++++++++ rakelib/rdoc.rake | 1 - templates/template.rb | 2 -- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/ext/prism/extension.c b/ext/prism/extension.c index 7a5dd8a984..e9e9f2ec2c 100644 --- a/ext/prism/extension.c +++ b/ext/prism/extension.c @@ -389,6 +389,7 @@ dump_input(pm_string_t *input, const pm_options_t *options) { } /** + * :markup: markdown * call-seq: * dump(source, **options) -> String * @@ -422,6 +423,7 @@ dump(int argc, VALUE *argv, VALUE self) { } /** + * :markup: markdown * call-seq: * dump_file(filepath, **options) -> String * @@ -794,6 +796,7 @@ parse_lex_input(pm_string_t *input, const pm_options_t *options, bool return_nod } /** + * :markup: markdown * call-seq: * lex(source, **options) -> LexResult * @@ -814,6 +817,7 @@ lex(int argc, VALUE *argv, VALUE self) { } /** + * :markup: markdown * call-seq: * lex_file(filepath, **options) -> LexResult * @@ -865,6 +869,7 @@ parse_input(pm_string_t *input, const pm_options_t *options) { } /** + * :markup: markdown * call-seq: * parse(source, **options) -> ParseResult * @@ -933,6 +938,7 @@ parse(int argc, VALUE *argv, VALUE self) { } /** + * :markup: markdown * call-seq: * parse_file(filepath, **options) -> ParseResult * @@ -968,6 +974,7 @@ profile_input(pm_string_t *input, const pm_options_t *options) { } /** + * :markup: markdown * call-seq: * profile(source, **options) -> nil * @@ -989,6 +996,7 @@ profile(int argc, VALUE *argv, VALUE self) { } /** + * :markup: markdown * call-seq: * profile_file(filepath, **options) -> nil * @@ -1041,6 +1049,7 @@ parse_stream_fgets(char *string, int size, void *stream) { } /** + * :markup: markdown * call-seq: * parse_stream(stream, **options) -> ParseResult * @@ -1094,6 +1103,7 @@ parse_input_comments(pm_string_t *input, const pm_options_t *options) { } /** + * :markup: markdown * call-seq: * parse_comments(source, **options) -> Array * @@ -1114,6 +1124,7 @@ parse_comments(int argc, VALUE *argv, VALUE self) { } /** + * :markup: markdown * call-seq: * parse_file_comments(filepath, **options) -> Array * @@ -1136,6 +1147,7 @@ parse_file_comments(int argc, VALUE *argv, VALUE self) { } /** + * :markup: markdown * call-seq: * parse_lex(source, **options) -> ParseLexResult * @@ -1163,6 +1175,7 @@ parse_lex(int argc, VALUE *argv, VALUE self) { } /** + * :markup: markdown * call-seq: * parse_lex_file(filepath, **options) -> ParseLexResult * @@ -1209,6 +1222,7 @@ parse_input_success_p(pm_string_t *input, const pm_options_t *options) { } /** + * :markup: markdown * call-seq: * parse_success?(source, **options) -> bool * @@ -1229,6 +1243,7 @@ parse_success_p(int argc, VALUE *argv, VALUE self) { } /** + * :markup: markdown * call-seq: * parse_failure?(source, **options) -> bool * @@ -1241,6 +1256,7 @@ parse_failure_p(int argc, VALUE *argv, VALUE self) { } /** + * :markup: markdown * call-seq: * parse_file_success?(filepath, **options) -> bool * @@ -1263,6 +1279,7 @@ parse_file_success_p(int argc, VALUE *argv, VALUE self) { } /** + * :markup: markdown * call-seq: * parse_file_failure?(filepath, **options) -> bool * @@ -1297,6 +1314,7 @@ string_query(pm_string_query_t result) { } /** + * :markup: markdown * call-seq: * local?(string) -> bool * @@ -1311,6 +1329,7 @@ string_query_local_p(VALUE self, VALUE string) { } /** + * :markup: markdown * call-seq: * constant?(string) -> bool * @@ -1325,6 +1344,7 @@ string_query_constant_p(VALUE self, VALUE string) { } /** + * :markup: markdown * call-seq: * method_name?(string) -> bool * diff --git a/rakelib/rdoc.rake b/rakelib/rdoc.rake index 5bba3e3cd5..deb98b0730 100644 --- a/rakelib/rdoc.rake +++ b/rakelib/rdoc.rake @@ -9,7 +9,6 @@ end RDoc::Task.new(:rdoc) do |rdoc| rdoc.main = "README.md" - rdoc.markup = "markdown" rdoc.rdoc_dir = "doc/rb" rdoc.options.push("--all", "-x", "lib/prism/translation/ripper/shim.rb") diff --git a/templates/template.rb b/templates/template.rb index 28ac475cdf..65e6ed0381 100755 --- a/templates/template.rb +++ b/templates/template.rb @@ -660,8 +660,6 @@ def render(name, write_to: nil) HEADING else <<~HEADING - /* :markup: markdown */ - /*----------------------------------------------------------------------------*/ /* This file is generated by the templates/template.rb script and should not */ /* be modified manually. See */