Anki笔记相关

本文介绍了如何使用TinyMCE的粘贴功能将Word文本转换为HTML并导入Anki,以及Anki中支持的LaTeX功能。通过LaTeX生成MathML,可以方便地在Microsoft Word中编辑数学公式,并以无格式方式粘贴,确保在Anki中呈现纯净的文本内容。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

相关文章:https://blog.youkuaiyun.com/stalendp/article/details/44904639

Anki是一个非常不错的记忆卡片工具,但是编辑界面比较简陋。

1. 这里将使用TinyMCE的粘贴功能,来获取word等工具编辑的文本,然后再转化成html,贴到anki中。

<!DOCTYPE html>
<html>
<head> 
<script src='https://cdn.tiny.cloud/1/no-api-key/tinymce/4.9.10-80/tinymce.min.js'></script>
<script>
   tinymce.init({
    selector: '#mytextarea',  // change this value according to your HTML
    plugins: "code",
    toolbar: "code",
    menubar: "tools",
    width: "800",
    height : "600",
  });
</script>
</head>

<body><h1>TinyMCE Quick Start Guide</h1> 
  <form method="post"><textarea id="mytextarea"></textarea></form>
</body>
</html>

2. Latex工具;

Anki是支持Latex的,下面是用来编辑Latex的工具。还可以导出成word使用的格式。

参考:Type math formulas in Microsoft Word the LaTeX way?

先用LaTeX生成MathML,然后以无格式的方式粘贴到word中(win: Ctrl+Alt+V,  mac: control + command + V);  或者粘贴到文本编辑器中,再粘贴回来(这样保证没有格式,是个纯文本)。

<!DOCTYPE html>
<html>
<head>
    <title>tex texample</title>
    <script src="http://apps.bdimg.com/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
  MathJax.Hub.Config({
      extensions: ["tex2jax.js"],
      jax: ["input/TeX", "output/HTML-CSS"],
      tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"] ],
          displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
      },
      "HTML-CSS": { availableFonts: ["TeX"] }
  });
</script>
    <script>
        function SelectText(element) {
            var doc = document
                , text = doc.getElementById(element)
                , range, selection
            ;    
            if (doc.body.createTextRange) {
                range = document.body.createTextRange();
                range.moveToElementText(text);
                range.select();
            } else if (window.getSelection) {
                selection = window.getSelection();        
                range = document.createRange();
                range.selectNodeContents(text);
                selection.removeAllRanges();
                selection.addRange(range);
            }
        }
		$(document).ready(function(){
      $("#latexContent").val("\\[  \\]");
			$('#latexContent').bind('input propertychange', function() {
			      $("#myoutput").text($("#latexContent").val());
			     // MathJax.Hub.Queue(["TypeseTextt",MathJax.Hub,"myoutput"]);
              MathJax.Hub.Typeset("myoutput")
              $("#myMathml").text("");
			});
			$("#btnShowMathML").click(function(){
				var con =  $(".MJX_Assistive_MathML").html();
				$("#myMathml").text(con);
				SelectText("myMathml");
			});
      $("#btnClear").click(function(){
				$("#latexContent").val("$$  $$");
        $("#myoutput").html("<p style='color: grey; font-style: italic;'> The LaTeX will display here ! </p>");
			});
 
		});
    </script>
</head>
<body>
	<center>
        <p> Enter LaTeX here! </p>
            <textarea id="latexContent" rows="5" cols="100"> </textarea>
        <button id="btnClear" type="button">clear</button>
        <button id="btnShowMathML" type="button">Show The MathML</button> </br></br>
        <span id="myoutput">
            <p style="color: grey; font-style: italic;"> The LaTeX will display here ! </p>
        </span> </br>
        <span id="myMathml"> </span>
    </center>
</body>
</html>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值