-
Notifications
You must be signed in to change notification settings - Fork 766
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
initial docify readme with some content #6333 #7093
base: master
Are you sure you want to change the base?
Conversation
All GitHub workflows were cancelled due to failure one of the required jobs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't run this yet, but I think it needs a few tweaks before it runs successfully. LMK if anything is not clear.
@@ -7,6 +7,13 @@ use alloc::{vec, vec::Vec}; | |||
|
|||
use polkadot_sdk::{staging_xcm as xcm, *}; | |||
|
|||
#[doc::include_str!("../../README.md")] | |||
#[cfg(feature = "generate-readme")] | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: empty line can be removed.
@@ -7,6 +7,13 @@ use alloc::{vec, vec::Vec}; | |||
|
|||
use polkadot_sdk::{staging_xcm as xcm, *}; | |||
|
|||
#[doc::include_str!("../../README.md")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to include the README as a string here. This line can be removed.
|
||
/// Generate the session keys from individual elements. | ||
/// | ||
/// The input must be a tuple of individual keys (a single arg for now since we have just one key). | ||
pub fn template_session_keys(keys: AuraId) -> SessionKeys { | ||
SessionKeys { aura: keys } | ||
} | ||
#[docify::export(name = "get_parachain_id")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about using export_content
instead of export
? This way we're getting only the PARACHAIN_ID
var name.
@@ -17,14 +24,19 @@ use sp_keyring::Sr25519Keyring; | |||
/// The default XCM version to set in genesis config. | |||
const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION; | |||
/// Parachain id used for genesis config presets of parachain template. | |||
pub const PARACHAIN_ID: u32 = 1000; | |||
#[export] | |||
pub const PARACHAIN_ID: u32 = 2000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a leftover committed while testing Readme recompilation. We can change it back to 1000.
cd parachain-template | ||
``` | ||
|
||
## Starting a Development Chain |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about adding a note at the beginning of this section where we embed the PARACHAIN_ID
const (as it is declared in the rust code), with docify::embed
, as described in these docs (https://docs.rs/docify/latest/docify/macro.compile_markdown.html)?
This prepares the reader for these hardcoded values that will be used across the code base.
#[doc::include_str!("../../README.md")] | ||
#[cfg(feature = "generate-readme")] | ||
|
||
docify::compile_markdown!("../..","../.."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be:
docify::compile_markdown!("../..","../.."); | |
docify::compile_markdown!("../../README.docify.md","../../README.md"); |
pub fn get_parachain_id() -> u32 { | ||
PARACHAIN_ID | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking again about this, I would have this function return a plain 1000
(such that it corresponds with the cost PARACHAIN_ID
). We should follow with a test that asserts PARACHAIN_ID == get_parachain_id()
. Might sound redundant, but this is to overcome the lack of docify support around interpolating exported primitive constants by value directly into the README.
Then, we can directly use the get_parachain_id
tag in the README.docify.md to interpolate 1000 into the doc wherever it is needed. I haven't tried this though, I have a slight concern it might not work everywhere.
Last thing would be to run cargo build --features generate-readme
to trigger the README.md compilation, based on the README.docify.md file.
pub fn get_parachain_id() -> u32 { | |
PARACHAIN_ID | |
} | |
const fn get_parachain_id() -> u32 { | |
1000 | |
} |
Use docify export for parachain template hardcoded configuration and embed it in its README #6333