本文将为您提供关于通过Jupyter动态生成的HTML未显示在MkDocs/Sphinx/JupyterBook的详细介绍,同时,我们还将为您提供关于(mkdocs)一款使用markdown编写web
本文将为您提供关于通过 Jupyter 动态生成的 HTML 未显示在 MkDocs/Sphinx/JupyterBook的详细介绍,同时,我们还将为您提供关于(mkdocs) 一款使用 markdown 编写 website 的插件、的实用信息。
本文目录一览:- 通过 Jupyter 动态生成的 HTML 未显示在 MkDocs/Sphinx/JupyterBook
- (mkdocs) 一款使用 markdown 编写 website 的插件
- HTML 未显示在 Webview 中
- IE 8 下 angular 动态生成的 select 的兼容指令
通过 Jupyter 动态生成的 HTML 未显示在 MkDocs/Sphinx/JupyterBook
如何解决通过 Jupyter 动态生成的 HTML 未显示在 MkDocs/Sphinx/JupyterBook
我正在尝试使用 Jupyter Notebooks (NB) 为某些代码创建文档。以前,我使用过 Sphinx,但想切换,因为它似乎不支持 Jupyter NB 的动态生成的 HTML 输出。我认为这是一个 Sphinx 问题,所以在查看后我找到了 MkDocs 和 Jupyter Books,但都没有人支持这一点。格式化时我会得到一个空格输出或 404: Not found
错误。
我尝试了 IPython 的 HTML()
、IFrame()
和 display()
函数的多种不同组合,但都没有成功。
我附上了一个简单的测试用例作为例子:
content = ''''''
<html><head><title>Webpage Template</title></head>
<body>
Hello,{strname} !
</body></html>
''''''
strname = "World"
htmlcontent = content.format(**locals())
outfile = open(''template.html'',''w'')
outfile.write(htmlcontent)
outfile.close()
import webbrowser,os.path
webbrowser.open(''file:///'' + os.path.abspath(''template.html''))
所以我的问题是如何在 MkDocs 或 Jupyter Book 的 Jupyter 输出单元格中显示我的 template.html
文件而不显示空白单元格。
(mkdocs) 一款使用 markdown 编写 website 的插件

推荐一款 markdown 的文档 website
* 自带服务 (开源)
* 可以添加镶嵌 html 代码
* 分目录结构
0. 准备 默认已经安装 python
$ python --version
Python 2.7.2
$ pip --version
pip 1.5.2
1. 安装 mkdocs
$ pip install mkdocs
2. 创建一个 mkdocs 项目
$ mkdocs new my-project && cd my-project
3. 启动服务
$ mkdocs serve
wiki 详见 mkdocs
开源地址 mkdocs
如何解决<select> 中 <option> 的 HTML 标题“提示”未显示在 mac OS chrome 浏览器上
我在使标题“提示”不显示在下拉选项中时遇到问题。这只发生在带有 Google chrome 的 Mac OS 上。
是否有解决此问题的方法?
代码片段/示例:
<select>
<option title="hint for example 1">Example 1</option>
<option title="hint for example 2">Example 2</option>
<option title="hint for example 3">Example 3</option>
</select>
HTML 未显示在 Webview 中
如何解决HTML 未显示在 Webview 中?
我试图在片段内的 web 视图中显示一些 HTML,但它没有显示。我在不同的应用程序中使用了相同的代码,它可以工作,但在这种情况下不起作用。我很茫然。我没有收到任何错误,只是没有显示 HTML。我可以看到 webview 正在出现。以下是我的片段、布局文件和使用片段的活动。
package com.siemens.google_glass_ict21_app.wirefragments;
import android.graphics.Color;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.widget.TextView;
import com.siemens.google_glass_ict21_app.R;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Base64;
import java.util.Scanner;
/**
* A simple {@link Fragment} subclass.
* Use the {@link grommetFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class grommetFragment extends BaseWireFragment {
private static final String TITLE_KEY = "title_key";
private static final String DESCRIPTION_KEY = "description_key";
private static final String WEBVIEW_KEY = "webview_key";
public static grommetFragment newInstance(String title,String description,String webView) {
grommetFragment fragment = new grommetFragment();
Bundle args = new Bundle();
args.putString(TITLE_KEY,title);
args.putString(DESCRIPTION_KEY,description);
args.putString(WEBVIEW_KEY,webView);
fragment.setArguments(args);
return fragment;
}
@Override
public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.grommet_fragment,container,false);
if(getArguments() != null){
final TextView textView = view.findViewById(R.id.textView3);
textView.setText(getArguments().getString(TITLE_KEY,""));
final TextView description = view.findViewById(R.id.textView2);
description.setText(getArguments().getString(DESCRIPTION_KEY,""));
WebView webView = (WebView) view.findViewById(R.id.webview);
String unencodedHtml = getArguments().getString(WEBVIEW_KEY,"");
String encodedHtml = Base64.getEncoder().encodetoString(unencodedHtml.getBytes());
webView.loadData(encodedHtml,"text/html","base64");
webView.setBackgroundColor(Color.TRANSPARENT);
}
// Inflate the layout for this fragment
return view;
}
}
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".wirefragments.grommetFragment">
<WebView
android:id="@+id/webview"
android:layout_width="640dp"
android:layout_height="296dp"
android:layout_gravity="bottom"
android:layout_marginTop="8dp" />
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="640dp"
android:layout_height="67dp"
android:orientation="horizontal">
<TextView
android:id="@+id/textView3"
android:layout_width="200dp"
android:layout_height="63dp"
android:layout_weight="0"
android:gravity="center"
android:text="TextView"
android:textAlignment="center"
android:textSize="30sp" />
<TextView
android:id="@+id/textView2"
android:layout_width="150dp"
android:layout_height="63dp"
android:layout_weight="1"
android:gravity="center"
android:text="TextView"
android:textAlignment="center"
android:textSize="30sp" />
</LinearLayout>
</FrameLayout>
package com.siemens.google_glass_ict21_app.activity;
import android.os.Bundle;
import android.util.Log;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.tabs.TabLayout;
import com.siemens.google_glass_ict21_app.R;
import com.siemens.google_glass_ict21_app.ui.BaseActivity;
import com.siemens.glass.ui.GlassGestureDetector;
import com.siemens.google_glass_ict21_app.wirefragments.BaseWireFragment;
import com.siemens.google_glass_ict21_app.wirefragments.grommetFragment;
import com.siemens.google_glass_ict21_app.wirefragments.LocateConnectorFragment;
import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
public class TemporaryPlaceHolderCardsActivity extends BaseActivity {
private List<BaseWireFragment> wireCards = new ArrayList<>();
private ViewPager viewPager;
final ScreenSlidePagerAdapter screenSlidePagerAdapter = new ScreenSlidePagerAdapter(
getSupportFragmentManager());
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.view_pager_layout);
viewPager = findViewById(R.id.viewPager);
viewPager.setAdapter(screenSlidePagerAdapter);
wireCards.add(grommetFragment.newInstance("grommet:","xyz","<a href=''https://svgshare.com/s/YLZ'' ><img src=''https://svgshare.com/i/YLZ.svg'' title='''' /></a>"));
//wireCards.add(LocateConnectorFragment.newInstance("grommet:","<a href=''https://svgshare.com/s/Z8d'' ><img src=''https://svgshare.com/i/Z8d.svg'' title='''' /></a>","<a href=''https://svgshare.com/s/Z8d'' ><img src=''https://svgshare.com/i/Z8d.svg'' title='''' /></a>"));
screenSlidePagerAdapter.notifyDataSetChanged();
final TabLayout tabLayout = findViewById(R.id.page_indicator);
tabLayout.setupWithViewPager(viewPager,true);
}
private class ScreenSlidePagerAdapter extends FragmentStatePagerAdapter {
ScreenSlidePagerAdapter(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int position) {
return wireCards.get(position);
}
@Override
public int getCount() {
return wireCards.size();
}
}
@Override
public boolean onGesture(GlassGestureDetector.Gesture gesture) {
switch (gesture) {
case TAP:
return true;
case TWO_FINGER_SWIPE_DOWN:
finish();
case SWIPE_DOWN:
return true;
default:
return super.onGesture(gesture);
}
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
IE 8 下 angular 动态生成的 select 的兼容指令
我们用的是 angular 1.2.5,以下代码也只用此版本测试过。
angular 渲 select 有很多坑,例如:官方推荐是用 ng-options,但是这样渲出来的下拉菜单在某些版本的 chrome 上是不可用的,所以为了兼容,我们舍弃了 ng-options。那么只剩下 ng-repeat 来渲下拉菜单,这样在 ie 8 下也是有坑的,对于动态生成的下拉菜单,ie 8 总是无法渲出各个 options,如图:
这种情况下就需要使用指令做点兼容,如下
<!-- 写出此等代码,只为方便,还望海涵 -->
<divng-repeat="courseTeacher in ctrl.newCourseTeacherList track by $index">
<select ng-model="ctrl.newCourseTeacherList[$index]" ie-select-fix="ctrl.teacherList">
<option ng-repeat="teacher in ctrl.teacherList track by teacher.id" value="{{teacher.id}}" ng-bind="teacher.name"></option>
</select>
</div>
// ieSelectFix directive
app.directive(''ieSelectFix'', [
''$document'',
function ($document) {
return {
restrict: ''A'',
require : ''ngModel'',
link : function (scope, element, attributes) {
var isIE = $document[0] && $document[0].attachEvent;
if (!isIE) return;
var $ele = element[0];
//to fix IE8 issue with parent and detail controller, we need to depend on the parent controller
scope.$watch(attributes.ieSelectFix, function () {
// setTimeout is needed starting from angular 1.3+
setTimeout(function () {
//this will add and remove the options to trigger the rendering in IE8
var oOption = new Option();
$ele.add(oOption);
$ele.remove($ele.options.children.length - 1);
}, 0);
});
}
}
}
]);
</script>
今天关于通过 Jupyter 动态生成的 HTML 未显示在 MkDocs/Sphinx/JupyterBook的讲解已经结束,谢谢您的阅读,如果想了解更多关于(mkdocs) 一款使用 markdown 编写 website 的插件、的相关知识,请在本站搜索。
本文标签: