use_markup(content)public
If there is a markup: parser_name comment at the front of the file, use it to determine the parser. For example:
# markup: rdoc # Class comment can go here class C end
The comment should appear as the first line of the content.
If the content contains a shebang or editor modeline the comment may appear on the second or third line.
Any comment style may be used to hide the markup comment.
# File lib/rdoc/parser.rb, line 228
def self.use_markup content
markup = content.lines.first(3).grep(/markup:\s+(\w+)/) { 1ドル }.first
return unless markup
# TODO Ruby should be returned only when the filename is correct
return RDoc::Parser::Ruby if ]tomdoc markdown].include? markup
markup = Regexp.escape markup
_, selected = RDoc::Parser.parsers.find do |_, parser|
/^#{markup}$/ =~ parser.name.sub(/.*:/, '')
end
selected
end