style(docs): display the documentation with its original title

This commit is contained in:
Orhun Parmaksız 2021-11-23 22:38:53 +03:00
parent ad7dfa48ed
commit 5f71f0510e
No known key found for this signature in database
GPG key ID: F83424824B3E4B90

View file

@ -162,16 +162,12 @@ impl Parameter {
/// Returns the parameter documentation if it exists.
pub fn get_documentation(&self) -> Option<String> {
self.description.as_ref().map(|description| {
let title = if let Some(absolute_name) = self.name.split('.').last() {
self.docs_title.replacen(absolute_name, &self.name, 1)
} else {
self.name.to_owned()
};
format!(
"{}\n{}\n{}\n-\nReference: {}",
title,
"=".repeat(title.len()),
"{}\n{}\n{}\n-\nParameter: {}\nReference: {}",
self.docs_title,
"=".repeat(self.docs_title.len()),
description,
self.name,
self.docs_path.to_string_lossy()
)
})