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

Add a new Render to working with OffsetIter? #71

Open
black-desk opened this issue Dec 9, 2024 · 3 comments
Open

Add a new Render to working with OffsetIter? #71

black-desk opened this issue Dec 9, 2024 · 3 comments

Comments

@black-desk
Copy link

Currently, we have jotdown::Render with a push method take Iterator<Item = Event> as input.
Can we have jotdown::OffsetRender with a push method with OffsetIter?

@black-desk
Copy link
Author

I am working on a djot formatter which need more information than event provided,
such as the number of ` around a Verbatim

@hellux
Copy link
Owner

hellux commented Dec 9, 2024

Another alternative might be to add the missing information to the events, it may be useful for other use cases as well. And it would be useful to be able to render to djot without necessarily having the offset information.

A few things that are missing:

  • number of ` delimiters for verbatim/raw inline
  • number of delimiters for verbatim/raw blocks
  • delimiter type of verbatim/raw blocks, ` or ~
  • number of : for div blocks

What else?

It is also not necessary to have a render trait for the formatting renderer, a crate can still provide a standalone function if offsets are required.

@black-desk
Copy link
Author

black-desk commented Dec 10, 2024

Another alternative might be to add the missing information to the events, it may be useful for other use cases as well. And it would be useful to be able to render to djot without necessarily having the offset information.

A few things that are missing:

  • number of ` delimiters for verbatim/raw inline

  • number of delimiters for verbatim/raw blocks

  • delimiter type of verbatim/raw blocks, ` or ~

  • number of : for div blocks

What else?

A few more:

  • The raw inline syntax delimiter, a djot formatter care about the delimiter is {* or *;

  • Whether email autolink starts with mailto:

  • The raw ThematicBreak

  • Element attributes in jotdown::Event::End

  • Whether attr value is wrapped by quotes

    This is not necessary, as formatter can save the attrs in Start event

It is also not necessary to have a render trait for the formatting renderer, a crate can still provide a standalone function if offsets are required.

Sure but it would be nice that jotdown have such a trait.

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

2 participants