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

Hello @agnostic-apollo , I find that this method is no longer effective #482

Open
owliao opened this issue Aug 13, 2024 · 1 comment
Open

Comments

@owliao
Copy link

owliao commented Aug 13, 2024

          Hello @agnostic-apollo ,

you do not need to deal with inline parsing, a simple visitor for Code would do -

private static void code(@NonNull MarkwonVisitor.Builder builder) {

val markwon = Markwon.builder(context)
  .usePlugin(object : AbstractMarkwonPlugin() {
    override fun configureVisitor(builder: MarkwonVisitor.Builder) {
      builder.on(Code::class.java) { visitor, node ->
        val length = visitor.length()
        visitor.builder().append(node.literal)
        visitor.setSpansForNodeOptional(node, length)
      }
    }
  })
  .build()

Originally posted by @noties in #169 (comment)

@owliao
Copy link
Author

owliao commented Aug 13, 2024

Now i use it

builder.on(FencedCodeBlock.class, new MarkwonVisitor.NodeVisitor<FencedCodeBlock>() {
            @Override
            public void visit(@NonNull MarkwonVisitor visitor, @NonNull FencedCodeBlock fencedCodeBlock) {
                visitCodeBlock(visitor, fencedCodeBlock.getInfo(), fencedCodeBlock.getLiteral(), fencedCodeBlock);
            }
        });

try to delete .append('\u00a0') in fun named visitCodeBlock
it like useful to me.
but i want to control margin by x dp , not by 1 '\u00a0'

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

1 participant