Markwon icon indicating copy to clipboard operation
Markwon copied to clipboard

How to make Latex show in RemoteView?

Open zhouzhuo810 opened this issue 3 years ago • 1 comments

  • Markwon version: 4.6.2
  1. Please specify expected/actual behavior

I need to display the Latex formula in an Android AppWidget. I use Markwon inside the App, but I can't assign a value because I can't get the TextView object in the AppWidget. Is there any way to solve this?

  1. Please specify conditions/steps to reproduce (layout, code, markdown used, etc)
Spanned xxx = markwon.toMarkdown("$$\n"+"xxx"+"\n$$");
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.appwidget_xxx);
views.setTextViewText(R.id.tv_xxx, xxx);

ask for help

zhouzhuo810 avatar May 08 '22 10:05 zhouzhuo810

@noties ask for help

zhouzhuo810 avatar May 08 '22 10:05 zhouzhuo810

Hello @zhouzhuo810 ,

unfortunately it won't be possible to display Markwon in a widget. Widgets use IPC (interprocess communication), so to display a spanned content - only platform spans can be used (that come from Android directly). Markwon uses own spans, so they won't be displayed - not only LaTeX, but others too.

You can take a look at the RemoteViewsSample, which substitutes custom spans with platform ones. But still LaTeX won't be possible, as internally it uses Drawable, which cannot be sent between processes

noties avatar Jan 09 '23 08:01 noties