Skip to content

Commit

Permalink
Remove "markdown-toc"
Browse files Browse the repository at this point in the history
  • Loading branch information
fxha committed Dec 13, 2018
1 parent 5afa379 commit a32a2ec
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -147,7 +147,6 @@
"html-tags": "^2.0.0",
"katex": "^0.10.0",
"keyboard-layout": "^2.0.14",
"markdown-toc": "^1.2.0",
"mermaid": "^8.0.0-rc.8",
"popper.js": "^1.14.6",
"prismjs2": "^1.15.0",
Expand Down
4 changes: 2 additions & 2 deletions src/muya/lib/parser/render/renderBlock/renderLeafBlock.js
@@ -1,7 +1,7 @@
import katex from 'katex'
import mermaid from 'mermaid'
import prism, { loadedCache } from '../../../prism/'
import { CLASS_OR_ID, DEVICE_MEMORY, isInElectron, PREVIEW_DOMPURIFY_CONFIG, HAS_TEXT_BLOCK_REG } from '../../../config'
import { CLASS_OR_ID, DEVICE_MEMORY, PREVIEW_DOMPURIFY_CONFIG, HAS_TEXT_BLOCK_REG } from '../../../config'
import { tokenizer } from '../../parse'
import { snakeToCamel, sanitize, escapeHtml, getLongUniqueId } from '../../../utils'
import { h, htmlToVNode } from '../snabbdom'
Expand Down Expand Up @@ -188,7 +188,7 @@ export default function renderLeafBlock (block, cursor, activeBlocks, matches, u
if (/^h\d$/.test(type)) {
Object.assign(data.dataset, {
head: type,
id: isInElectron ? require('markdown-toc').slugify(text.replace(/^#+\s(.*)/, (_, p1) => p1)) : ''
id: '' // isInElectron ? require('markdown-toc').slugify(text.replace(/^#+\s(.*)/, (_, p1) => p1)) : ''
})
selector += `.${headingStyle}`
}
Expand Down
12 changes: 9 additions & 3 deletions src/renderer/store/editor.js
Expand Up @@ -5,7 +5,7 @@ import { hasKeys } from '../util'
import { getOptionsFromState, getSingleFileState, getBlankFileState } from './help'
import notice from '../services/notification'

const toc = require('markdown-toc')
// const toc = require('markdown-toc')
const state = {
lineEnding: 'lf',
currentFile: {},
Expand All @@ -15,8 +15,14 @@ const state = {

const getters = {
toc: state => {
const { currentFile } = state
return toc(currentFile.markdown).json
// const { currentFile } = state
// console.log(toc(currentFile.markdown).json) // #DEBUG
// content: "GitHub Flavored Markdown"
// i: 0
// lvl: 1
// seen: 0
// slug: "github-flavored-markdown"
return [] // toc(currentFile.markdown).json
}
}

Expand Down

0 comments on commit a32a2ec

Please sign in to comment.