pub struct CMarkReadme<P, M> { /* private fields */ }
Expand description
Parsed readme Markdown with optionally specified package path and package manifest.
Implementations§
Source§impl<'a> CMarkReadme<&'a Path, &'a Manifest>
impl<'a> CMarkReadme<&'a Path, &'a Manifest>
Sourcepub fn from_package(
package: &'a Package,
) -> Result<Self, CMarkReadmeFromPackageError>
pub fn from_package( package: &'a Package, ) -> Result<Self, CMarkReadmeFromPackageError>
Creates readme from package.
It reads readme file by path specified in the package manifest.
Source§impl CMarkReadme<(), ()>
impl CMarkReadme<(), ()>
Source§impl<'a, P, M> CMarkReadme<P, M>
impl<'a, P, M> CMarkReadme<P, M>
Sourcepub fn with_package_path(
self,
package_path: &'a Package,
) -> CMarkReadme<&'a Package, M>
pub fn with_package_path( self, package_path: &'a Package, ) -> CMarkReadme<&'a Package, M>
Adding the specified package path to the readme.
Sourcepub fn with_manifest(
self,
manifest: &'a Manifest,
) -> CMarkReadme<P, &'a Manifest>
pub fn with_manifest( self, manifest: &'a Manifest, ) -> CMarkReadme<P, &'a Manifest>
Adding the specified manifest to the readme.
Sourcepub fn from_file_and_package_path_and_manifest(
file: Arc<File>,
package_path: P,
manifest: M,
) -> Self
pub fn from_file_and_package_path_and_manifest( file: Arc<File>, package_path: P, manifest: M, ) -> Self
Creates readme from file, package path and manifest.
Sourcepub fn from_data_and_package_path_and_manifest(
data: CMarkData,
package_path: P,
manifest: M,
) -> Self
pub fn from_data_and_package_path_and_manifest( data: CMarkData, package_path: P, manifest: M, ) -> Self
Creates readme from CMark items, package path and manifest.
Sourcepub fn package_path(&self) -> &P
pub fn package_path(&self) -> &P
Returns the package path.
Sourcepub fn iter(&self) -> CMarkDataIter<'_>
pub fn iter(&self) -> CMarkDataIter<'_>
Iterate over CMarkItem
s.
Sourcepub fn iter_events(&self) -> impl Iterator<Item = &Event<'_>>
pub fn iter_events(&self) -> impl Iterator<Item = &Event<'_>>
Iterate over pulldown-cmark events.
Sourcepub fn concat_texts(self) -> CMarkReadme<P, M>
pub fn concat_texts(self) -> CMarkReadme<P, M>
Concatenate adjacent text events.
Use this transformation if you deleted some nodes manually and want to merge the neighboring text nodes.
This transformation is always applied right after readme and docs parsing, because some text events remain ununited. For example Rust attribute parser generate seperate text events for every line of source code, and pulldown_cmark generate seperate text events for character entity reference.
Sourcepub fn remove_images_only_paragraph<F>(self, predicate: F) -> CMarkReadme<P, M>
pub fn remove_images_only_paragraph<F>(self, predicate: F) -> CMarkReadme<P, M>
Removes first paragraph that contains only images and image-links, if the specified predicate returns true when passing image urls to it.
Sourcepub fn remove_badges_paragraph(self) -> CMarkReadme<P, M>
pub fn remove_badges_paragraph(self) -> CMarkReadme<P, M>
Removes first paragraph that contains only badges.
Sourcepub fn remove_section(self, heading: &str, level: u32) -> Self
pub fn remove_section(self, heading: &str, level: u32) -> Self
Remove section with the specified heading text and level and its subsections.
Sourcepub fn remove_codeblock_tag(self, tag: &str) -> CMarkReadme<P, M>
pub fn remove_codeblock_tag(self, tag: &str) -> CMarkReadme<P, M>
Remove the specified fenced code block tag.
Remove the specified fenced code block tags.
Sourcepub fn remove_documentation_section(self) -> Self
pub fn remove_documentation_section(self) -> Self
Remove sections with heading Documentation
and level 2.
Sourcepub fn disallow_absolute_blob_links(
self,
repository_url: &str,
) -> Result<CMarkReadme<P, M>, DisallowUrlsWithPrefixError>
pub fn disallow_absolute_blob_links( self, repository_url: &str, ) -> Result<CMarkReadme<P, M>, DisallowUrlsWithPrefixError>
Returns self if absolute blob links to the specified repository not found, otherwise returns an error.
Sourcepub fn use_absolute_blob_urls(self, repository_url: &str) -> CMarkReadme<P, M>
pub fn use_absolute_blob_urls(self, repository_url: &str) -> CMarkReadme<P, M>
Convert all relative links into absolute ones using the repository url as the root address.
Source§impl<'a, P> CMarkReadme<P, &'a Manifest>
impl<'a, P> CMarkReadme<P, &'a Manifest>
Sourcepub fn disallow_absolute_repository_blob_links(
self,
) -> Result<CMarkReadme<P, &'a Manifest>, DisallowAbsoluteRepositoryBlobLinksError>
pub fn disallow_absolute_repository_blob_links( self, ) -> Result<CMarkReadme<P, &'a Manifest>, DisallowAbsoluteRepositoryBlobLinksError>
Returns self if absolute blob links to the manifest repository not found, otherwise returns an error.
Sourcepub fn use_absolute_repository_blob_urls(
self,
) -> Result<CMarkReadme<P, &'a Manifest>, UseAbsoluteRepositoryBlobUrlsError>
pub fn use_absolute_repository_blob_urls( self, ) -> Result<CMarkReadme<P, &'a Manifest>, UseAbsoluteRepositoryBlobUrlsError>
Convert all relative links into absolute ones using the manifest repository url as the root address.
Trait Implementations§
Source§impl<P: Clone, M: Clone> Clone for CMarkReadme<P, M>
impl<P: Clone, M: Clone> Clone for CMarkReadme<P, M>
Source§fn clone(&self) -> CMarkReadme<P, M>
fn clone(&self) -> CMarkReadme<P, M>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more