Skip to content
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 header level option #15

Open
sooda opened this issue Aug 15, 2020 · 1 comment · May be fixed by #24
Open

Initial header level option #15

sooda opened this issue Aug 15, 2020 · 1 comment · May be fixed by #24

Comments

@sooda
Copy link
Contributor

sooda commented Aug 15, 2020

Sometimes non-standalone content is supposed to go inside a document that has some top-level headers already, so starting the rendered content headers with <h1> would not be desirable. In Docutils, this is fixed with the initial_header_level option. In rust-rst, rst_renderer::render_html() doesn't seem to support any options besides the standalone mode and it initializes the HTMLRenderer.level (used for rendering elements::Title) to 0.

It would be helpful to provide an option to set some other value than zero here. Additional options will likely be useful in the future as well, so adding an extra API to render content with an options struct or something might be a good idea?

@flying-sheep
Copy link
Owner

Sounds very useful. I also think that in the future, we might want more options like passing custom directives or so.

I think I’ll research a bit how to best do options these days (is the builder pattern still en vogue or what?) and then accept Into<Options> in place of the options, an implementation for bool (which would simply set Options.standalone)

I’m not super concerned about backwards compat as this is still 0.x, but why break stuff if we can avoid it?

@flying-sheep flying-sheep linked a pull request Oct 25, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants