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

1.0 Roadmap #27

Open
3 tasks
maciejhirsz opened this issue Mar 17, 2020 · 3 comments
Open
3 tasks

1.0 Roadmap #27

maciejhirsz opened this issue Mar 17, 2020 · 3 comments

Comments

@maciejhirsz
Copy link
Owner

maciejhirsz commented Mar 17, 2020

I feel like we are in a pretty good place right now with the feature set and the API surface. Checklist for 1.0 release:

  • Remove(!) #[md] and markdown support. Figure out more generic way to support writing to encoders without intermediate buffers from iterators like pulldown_cmark's one.
  • Template interrogation as per Feature request: interrogate templates #1 (seriously, 1).
  • ..?
@luciusmagn
Copy link

Is some if-like structure planned?

Also will there be an easy replacement for #[md] available? I like this feature quite a bit, so I am wondering if I were to depend on it for now. I am currently trying to reduce dependencies and code in my fork of mdblog and #[md] seems like a godsend.

@maciejhirsz
Copy link
Owner Author

Sections serve as if conditions in Mustache: {{#condition}}...{{/condition}}. You can use a boolean on a flat struct, or you can use an Option:

#[derive(Content)]
struct Foo {
    name: &'static str,
    maybe_bar: Option<Bar>,
}

#[derive(Content)]
struct Bar {
    count: usize,
}

Will work with {{name}} {{#maybe_bar}}{{count}}{{/maybe_bar}}.

As for #[md], my idea would be to replace it with something like #[callback(some_fn)], where some_fn is a function you've defined that takes a ref to the field, and a mut ref to generic std::fmt::Write (or std::io::Write), so you can just grab whatever markdown and pipe it through pulldown_cmark (which is basically what Ramhorns is doing now). Whenever that happens I'll be sure to include a migration guide in release notes.

@grego
Copy link
Contributor

grego commented Dec 3, 2021

I think there could be #[ramhorns(callback = "some_fn")], where some_fn would take a ref to the field and a mut ref to a generic Encoder. Also, #[ramhorns(md)] or even #[md] could be kept for the case of some_fn equal to ramhorns::cmark::encode.
I can implement this if it sounds alright.

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

No branches or pull requests

3 participants