简体   繁体   English

jupyter 笔记本上每个单元格的多个 Markdown 翻译

[英]Multiple Markdown translations per cell on jupyter notebooks

Is there a native way or widget on jupyter notebooks to set a markdown cell to create something like html tabs so I can add documentation on each language I want instead of creating 3 different notebooks that will add complexity in the maintainability of my experiments? jupyter notebooks 上是否有本地方法或小部件来设置 markdown 单元格以创建类似html tabs的内容,这样我就可以为我想要的每种语言添加文档,而不是创建 3 个不同的笔记本,这会增加我实验的可维护性的复杂性?

Being able to add something like this will suffice能够添加这样的东西就足够了

<!-- Tab links -->
<div class="tab">
  <button class="tablinks" onclick="openCity(event, 'Spanish')">Spanish</button>
  <button class="tablinks" onclick="openCity(event, 'English')">English</button>
  <button class="tablinks" onclick="openCity(event, 'Japanese')">Japanese</button>
</div>

<!-- Tab content -->
<div id="Spanish" class="tabcontent">
  <h3>Spanish Explanation</h3>
  <p>This is an explanation in Spanish</p>
</div>

<div id="English" class="tabcontent">
  <h3>English Explanation</h3>
  <p>This is an explanation in English</p>
</div>

<div id="Japanese" class="tabcontent">
  <h3>Japanese Explanation</h3>
  <p>This is an explanation in Japanese</p>
</div>

ipywidgets includes tabs and to make it look like a markdown cell you could either hide the code or make a Voila app. ipywidgets 包含选项卡并使其看起来像降价单元格,您可以隐藏代码或制作 Voila 应用程序。 There are several extensions to do that, such as Hide input , Hide input all , & hide_code .有几个扩展可以做到这一点,例如Hide inputHide input allhide_code (The first two are part of the community-contributed unofficial extensions (jupyter_contrib_nbextensions) that get installed as bundle. Voila is described here and there is a gallery of examples . (前两个是 社区贡献的非官方扩展(jupyter_contrib_nbextensions)的一部分,它们作为捆绑包安装。Voila在此处进行了描述,并且有一个示例库

For something simpler that works natively in a notebook markdown cell and renders well for when the notebooks may be statically represented, there is collapsible markdown .对于在笔记本 markdown 单元中本机工作并且在笔记本可以静态表示时呈现良好的更简单的东西,有可折叠的 markdown A fancier version of this called Collapsible Headings is included as part of the unofficial extensions bundle I mentioned above.这个称为Collapsible Headings的更漂亮的版本包含在我上面提到的非官方扩展包中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM