yaohaixiao / outline.js Goto Github PK
View Code? Open in Web Editor NEWoutline.js - 自动生成文章导读(Table of Contents)导航的 JavaScript 工具。会自动分析文章中的标题( h1~h6 )标签,并生成文章段落层次结构的导读导航菜单。
Home Page: https://yaohaixiao.github.io/outline.js/
License: MIT License
outline.js - 自动生成文章导读(Table of Contents)导航的 JavaScript 工具。会自动分析文章中的标题( h1~h6 )标签,并生成文章段落层次结构的导读导航菜单。
Home Page: https://yaohaixiao.github.io/outline.js/
License: MIT License
兄弟,对于不支持的低版本的浏览器,能不能直接console.log说下不支持低版本浏览器?
现在是直接抛错,不太好。抛错后,可能会影响后面JS的正常运行。
现在还在用chrome54内核的路过。
兄弟,这个插件如何直接就显示出目录导航,而不用点击列表再显示目录导航?
1、bug:样式与dz论坛的点评冲突了。
地址:http://biji.sebcxy.com/forum.php?mod=viewthread&tid=49&extra=
2、建议:给outline.min.js加个版本号,我没看到版本号
是不是用这个项目目录里的两个文件就可以了: outline.min.js、 outline.min.css。我一直这样用。
例如我正在编辑文章,这时候新加入了标题,我想要实时更新目录
你好,这里有一个问题。
文章内容中存在h1-h6标签
目录导读也可以准确识别
但在阅读模式中只获取到了h2和h4标签
这个问题请问如何解决呢。
ERROR Failed to compile with 1 error 17:02:39
error in ./node_modules/@yaohaixiao/outline.js/outline.js
Module parse failed: Unexpected token (347:14)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| }
| }
if (tools?.length > 0) {
| buttons.push(...tools)
| }
@ ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/blog/detail.vue?vue&type=script&lang=js 12:38-79
@ ./src/views/blog/detail.vue?vue&type=script&lang=js
@ ./src/views/blog/detail.vue
@ ./src/router/index.js
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://192.168.8.16:81&sockPath=/sockjs-node (webpack)/hot/dev-server.js ./src/main.js
如题,个人认为这样子更友好一些
没有目录树的情况下只能点击向下的按钮抵达底部,到底部的时候向上返回顶部的按钮出不来
JS代码如下
(function(){
var asideElement = document.getElementById("aside");
if(asideElement){
const defaults = Outline.DEFAULTS
let outline
defaults.position = 'sticky'
defaults.stickyHeight = 86
defaults.parentElement = '#aside'
defaults.articleElement = '.blog-content'
outline = new Outline(Outline.DEFAULTS)
outline.reload({
title: 'Contents',
hasToolbar: false,
showCode: false,
})
}else{
}
})()
代码中的第三行报错, this.$el为null
highlight(t) {
const e = this.attr("animationCurrent")
, s = this.$el.querySelector(`#chapter__anchor-${t}`)
, i = "outline-chapters_active"
, r = "outline-chapters_highlight";
return s ? (this.active = parseInt(s.getAttribute("data-id"), 10),
this.$active && (u(this.$active, r),
u(this.$active, i)),
this.$active = s,
a(this.$active, i),
e ? this.positionPlaceholder(this.active) : a(this.$active, r),
this) : this
}
点击生成的目录,无法跳转指定标签
超长文章滚动到后面,章节标题已经超出大纲第一页了,能否让大纲也能自动滚动到所在的章节
你好,在浏览器Chromium 60.0.3112.113版本上,点击文章目录导航却不跳转,这算是bug吗?
或许说,使用了新技术不支持老旧的chrome内核?
npm install -S autoc.js
--> npm install -S autocjs
如题
你好vue里面需要怎么使用这个主键
H1-H6标题中包含数字会被过滤
如
1.xxxxx
2.xxxxxx
目录树会变成.xxxx
就是数字被过滤掉了
首先感谢提供如此方便的插件,点个赞~
这里有两个问题想咨询一下
1、在不直接修改代码的情况下,有没有内置方法可以添加右侧独立菜单栏的按钮,并可添加点击该按钮的方法呢
2、当文章没有h1-h6标签时右侧底部菜单栏是没有导航目录图标的,但跳转到顶部和底部的按钮还是存在的,但js中似乎有判断当没有h1-h6标签时其他按钮的点击事件失效,有办法在没有h1-h6标签的情况下让跳转顶部/底部按钮仍旧可用吗。
第二个可能有点啰嗦,简单点说就是没有h1-h6标签时跳转顶部和底部按钮点击不了,这个不知道是否有配置项。
defaults.scrollElement = '#scroll'
defaults.articleElement = '#content'
正常展示,但是换成DOM元素
defaults.scrollElement = document.getElementById('scroll');
defaults.articleElement = document.getElementById('content');
报错:
outline.js:57 Uncaught DOMException: Failed to execute 'querySelector' on 'Document': '[object HTMLDivElement]' is not a valid selector.
at st.render (file:///D:/code/outline.js-master/docs/js/outline.min.js:1:34033)
at st.initialize (file:///D:/code/outline.js-master/docs/js/outline.min.js:1:33860)
at new st (file:///D:/code/outline.js-master/docs/js/outline.min.js:1:33768)
at file:///D:/code/outline.js-master/docs/toc.html:153:15
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.