Inserts content of md files into src/*.rs
files.
The lmake_readme.exe
must be executed in the root project folder where is the cargo.toml.
All the relative paths starts from there.
The location of the exe file does not matter:
ex. /home/luciano/rustprojects/utils_linux/lmake_readme
.
No arguments needed to execute the util.
FInd the documentation at:
https://lucianobestia.github.io/lmake_readme/
I will never build a project exclusively for Windows. I hope.
All the server projects will run on Linux web servers.
The frontend will be in Wasm/Webassembly that is OS agnostic.
So it makes sense to always build projects for Linux.
It is now possible easily because of Linux subsystem for windows.
All utils I use in the building process must be also Linux executables.
Markers are special phrases in comments.
In the rs files finds this markers:
rust
// region: lmake_readme insert "filename.md"
// endregion: lmake_readme insert "filename.md"
Removes the old lines between the markers.
Read the filename of the md file to insert.
Read the md file.
Removes the lines between this markers:
markdown
Replaces the marker
markdown
with the version in cargo.toml.
Before each line adds the comment symbol //!_
.
Inserts the new lines between the markers in the rs file.
In Makefile.toml
for cargo make
add a call like this:
```toml [tasks.doc] description = "create docs from comments" clear = true dependencies = [ "insert-readme", "cargo-doc", "doc-copy", ]
[tasks.insert-readme] clear = true private = true description = "copy the content of readme.md into *.rs comments (for the docs)" script= ["/home/luciano/rustprojects/utilslinux/lmakereadme"]
[tasks.cargo-doc] clear = true private = true description = "call cargo doc" command="cargo" args=["doc","--no-deps","--document-private-items"]
[tasks.doc-copy] clear = true private = true description = "copy doc folder as docs (out of folder target), so it can be git committed" script = [ "\rsync -avz --delete-after target/doc/* docs/" ] ```
Publish in crates.io as binary.
Users then install it like:
cargo install lmake_readme
https://rust-cli.github.io/book/tutorial/packaging.html