Markwon icon indicating copy to clipboard operation
Markwon copied to clipboard

How to use $ latex $ inline latex ?

Open zhouzhuo810 opened this issue 3 years ago • 3 comments

  • Markwon version: {REQUIRED}

How to use $ latex $ inline latex ?

I can use $$ latex $$ now, but can not use $ latex $, can you help me ?

mMarkwon = Markwon
            .builder(this)
            .usePlugin(StrikethroughPlugin.create())
            .usePlugin(TaskListPlugin.create(MarkdownDetailPlusImmersiveActivity.this))
            .usePlugin(SyntaxHighlightPlugin.create(new Prism4j(new MyGrammarLocator()), isNightMode() ? Prism4jThemeDarkula.create()
                : Prism4jThemeDefault.create()))
            .usePlugin(HtmlPlugin.create(new HtmlPlugin.HtmlConfigure() {
                @Override
                public void configureHtml(@NonNull HtmlPlugin plugin) {
                    plugin.addHandler(new AlignTagHandler());
                    plugin.addHandler(new FontColorTagHandler());
                }
            }))
            .usePlugin(TablePlugin.create(new TablePlugin.ThemeConfigure() {
                @Override
                public void configureTheme(@NonNull TableTheme.Builder builder) {
                    boolean nightMode = isNightMode();
                    builder
                        .tableBorderWidth(2)
                        .tableEvenRowBackgroundColor(Color.parseColor(nightMode ? "#4Dcccccc" : "#4D9EBCE2"))
                        .tableOddRowBackgroundColor(Color.parseColor(nightMode ? "#2Dcccccc" : "#2D9EBCE2"))
                        .tableCellPadding(SettingUtil.getScaleTextSize(4));
                }
            }))
            .usePlugin(ImagesPlugin.create(new ImagesPlugin.ImagesConfigure() {
                @Override
                public void configureImages(@NonNull ImagesPlugin plugin) {
                    plugin.addMediaDecoder(SvgPictureMediaDecoder.create());
                    plugin.addMediaDecoder(GifMediaDecoder.create(true));
                    plugin.addSchemeHandler(FileSchemeHandler.create());
                    plugin.addSchemeHandler(OkHttpNetworkSchemeHandler.create());
                }
            }))
            .usePlugin(PicassoImagesPlugin.create(Picasso.get()))
            .usePlugin(new AbstractMarkwonPlugin() {
                @Override
                public void configureConfiguration(@NonNull MarkwonConfiguration.Builder builder) {
                    super.configureConfiguration(builder);
                    builder.linkResolver(new MyLinkResolver());
                }
                
                @Override
                public void beforeSetText(@NonNull TextView textView, @NonNull Spanned markdown) {
                    super.beforeSetText(textView, markdown);
                    AsyncDrawableScheduler.unschedule(textView);
                }
                
                @Override
                public void afterSetText(@NonNull TextView textView) {
                    super.afterSetText(textView);
                    AsyncDrawableScheduler.schedule(textView);
                }
            })
            .usePlugin(MarkwonInlineParserPlugin.create())
            .usePlugin(JLatexMathPlugin.create(mEtMarkdown.getTextSize(), new JLatexMathPlugin.BuilderConfigure() {
                @Override
                public void configureBuilder(@NonNull JLatexMathPlugin.Builder builder) {
                    builder.inlinesEnabled(true);
                }
            }))
            .build();

zhouzhuo810 avatar Aug 07 '21 01:08 zhouzhuo810

Hello @zhouzhuo810 ,

unfortunately there is no way use single $ signs to mark inline latex out of box

noties avatar Aug 10 '21 19:08 noties

Hello @zhouzhuo810 ,

unfortunately there is no way use single $ signs to mark inline latex out of box

Okay, Thank you ! I find it works in Pure Writer App with $ , but I don't kown how it does.

zhouzhuo810 avatar Aug 12 '21 05:08 zhouzhuo810

@noties are you ok? I need your help

  1. situation 1
<video id="video" controls="" preload="none" poster="file:///storage/emulated/0/Android/data/me.zhouzhuo810.zznote/tiny/2023_12_07_14_58_34.jpg">
<source id="mp4" src="file:///storage/emulated/0/Android/data/me.zhouzhuo810.zznote/tiny/2023_12_07_14_58_33.mp4" type="video/mp4">
</video>

use SimpleTagHandler to parse

Result :

HtmlTag's start == end ,

  1. situation 2
<video id="video" controls="" preload="none" poster="file:///storage/emulated/0/Android/data/me.zhouzhuo810.zznote/tiny/2023_12_07_14_58_34.jpg"><source id="mp4" src="file:///storage/emulated/0/Android/data/me.zhouzhuo810.zznote/tiny/2023_12_07_14_58_33.mp4" type="video/mp4">
</video>

use SimpleTagHandler to parse

Result :

HtmlTag's start != end

That's why ? it seems that MarkwonHtmlParser has some problem

zhouzhuo810 avatar Dec 07 '23 07:12 zhouzhuo810