zheland / readme-sync Goto Github PK
View Code? Open in Web Editor NEWChecks that your readme and documentation are synchronized
License: Apache License 2.0
Checks that your readme and documentation are synchronized
License: Apache License 2.0
It can be useful to write the expected output to a file instead of using assert_sync
to only check for differences.
I wasn't able to find a way to do this.
I wasn't able to get readme-sync to do any transformation of links. Here is a minimal example.
Cargo.toml
:
[package]
name = "test-readme-sync"
version = "0.0.0"
edition = "2021"
publish = false
documentation = "https://docs.rs/test-readme-sync"
repository = "https://github.com/daxpedda/test-readme-sync"
[dev-dependencies]
readme-sync = "0.2"
lib.rs
:
//! Test
//! [`Test`]
//! [`Test`](crate::Test)
//! [Test]
//!
//! [Test]: crate::Test
pub struct Test;
#[test]
fn readme_sync_test() {
use readme_sync::{assert_sync, CMarkDocs, CMarkReadme, Config, Package};
let package = Package::from_path(env!("CARGO_MANIFEST_DIR").into()).unwrap();
let config = Config::from_package_docs_rs_features(&package);
let readme = CMarkReadme::from_package(&package).unwrap();
let docs = CMarkDocs::from_package_and_config(&package, &config).unwrap();
let readme = readme
.remove_badges_paragraph()
.remove_documentation_section()
.remove_codeblock_tag("no_sync")
.disallow_absolute_repository_blob_links()
.unwrap()
.use_absolute_repository_blob_urls()
.unwrap();
let docs = docs
.increment_heading_levels()
.add_package_title()
.remove_codeblock_rust_test_tags()
.use_default_codeblock_rust_tag()
.remove_hidden_rust_code()
.disallow_absolute_package_docs_links()
.unwrap()
.use_absolute_package_docs_urls()
.unwrap();
assert_sync(&readme, &docs);
}
README.md
:
# test-readme-sync
Test
[`Test`]
[`Test`](crate::Test)
[Test]
[Test]: crate::Test
I expected the test to fail, because of use_absolute_package_docs_urls
, but it succeeds instead.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.