mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 01:36:22 +00:00
Merge pull request #2346 from daiyam/text-deflist
add support to abbreviations, definition lists and subscript/superscript text
This commit is contained in:
@@ -373,6 +373,36 @@ for name, val in admonition_types
|
|||||||
color: val[color]
|
color: val[color]
|
||||||
content: val[icon]
|
content: val[icon]
|
||||||
|
|
||||||
|
dl
|
||||||
|
margin 2rem 0
|
||||||
|
padding 0
|
||||||
|
display flex
|
||||||
|
width 100%
|
||||||
|
flex-wrap wrap
|
||||||
|
align-items flex-start
|
||||||
|
border-bottom 1px solid borderColor
|
||||||
|
background-color tableHeadBgColor
|
||||||
|
|
||||||
|
dt
|
||||||
|
border-top 1px solid borderColor
|
||||||
|
font-weight bold
|
||||||
|
text-align right
|
||||||
|
overflow hidden
|
||||||
|
flex-basis 20%
|
||||||
|
padding 0.4rem 0.9rem
|
||||||
|
box-sizing border-box
|
||||||
|
|
||||||
|
dd
|
||||||
|
border-top 1px solid borderColor
|
||||||
|
flex-basis 80%
|
||||||
|
padding 0.4rem 0.9rem
|
||||||
|
min-height 2.5rem
|
||||||
|
background-color $ui-noteDetail-backgroundColor
|
||||||
|
box-sizing border-box
|
||||||
|
|
||||||
|
dd + dd
|
||||||
|
margin-left 20%
|
||||||
|
|
||||||
pre.fence
|
pre.fence
|
||||||
flex-wrap wrap
|
flex-wrap wrap
|
||||||
|
|
||||||
@@ -436,6 +466,14 @@ body[data-theme="dark"]
|
|||||||
kbd
|
kbd
|
||||||
background-color themeDarkBorder
|
background-color themeDarkBorder
|
||||||
color themeDarkText
|
color themeDarkText
|
||||||
|
dl
|
||||||
|
border-color themeDarkBorder
|
||||||
|
background-color themeDarkTableHead
|
||||||
|
dt
|
||||||
|
border-color themeDarkBorder
|
||||||
|
dd
|
||||||
|
border-color themeDarkBorder
|
||||||
|
background-color themeDarkPreview
|
||||||
|
|
||||||
themeSolarizedDarkTableOdd = $ui-solarized-dark-noteDetail-backgroundColor
|
themeSolarizedDarkTableOdd = $ui-solarized-dark-noteDetail-backgroundColor
|
||||||
themeSolarizedDarkTableEven = darken($ui-solarized-dark-noteDetail-backgroundColor, 10%)
|
themeSolarizedDarkTableEven = darken($ui-solarized-dark-noteDetail-backgroundColor, 10%)
|
||||||
@@ -463,6 +501,14 @@ body[data-theme="solarized-dark"]
|
|||||||
border-color themeSolarizedDarkTableBorder
|
border-color themeSolarizedDarkTableBorder
|
||||||
&:last-child
|
&:last-child
|
||||||
border-right solid 1px themeSolarizedDarkTableBorder
|
border-right solid 1px themeSolarizedDarkTableBorder
|
||||||
|
dl
|
||||||
|
border-color themeDarkBorder
|
||||||
|
background-color themeSolarizedDarkTableHead
|
||||||
|
dt
|
||||||
|
border-color themeDarkBorder
|
||||||
|
dd
|
||||||
|
border-color themeDarkBorder
|
||||||
|
background-color $ui-solarized-dark-noteDetail-backgroundColor
|
||||||
|
|
||||||
themeMonokaiTableOdd = $ui-monokai-noteDetail-backgroundColor
|
themeMonokaiTableOdd = $ui-monokai-noteDetail-backgroundColor
|
||||||
themeMonokaiTableEven = darken($ui-monokai-noteDetail-backgroundColor, 10%)
|
themeMonokaiTableEven = darken($ui-monokai-noteDetail-backgroundColor, 10%)
|
||||||
@@ -492,6 +538,14 @@ body[data-theme="monokai"]
|
|||||||
border-right solid 1px themeMonokaiTableBorder
|
border-right solid 1px themeMonokaiTableBorder
|
||||||
kbd
|
kbd
|
||||||
background-color themeDarkBackground
|
background-color themeDarkBackground
|
||||||
|
dl
|
||||||
|
border-color themeDarkBorder
|
||||||
|
background-color themeMonokaiTableHead
|
||||||
|
dt
|
||||||
|
border-color themeDarkBorder
|
||||||
|
dd
|
||||||
|
border-color themeDarkBorder
|
||||||
|
background-color $ui-monokai-noteDetail-backgroundColor
|
||||||
|
|
||||||
themeDraculaTableOdd = $ui-dracula-noteDetail-backgroundColor
|
themeDraculaTableOdd = $ui-dracula-noteDetail-backgroundColor
|
||||||
themeDraculaTableEven = darken($ui-dracula-noteDetail-backgroundColor, 10%)
|
themeDraculaTableEven = darken($ui-dracula-noteDetail-backgroundColor, 10%)
|
||||||
@@ -520,4 +574,12 @@ body[data-theme="dracula"]
|
|||||||
&:last-child
|
&:last-child
|
||||||
border-right solid 1px themeDraculaTableBorder
|
border-right solid 1px themeDraculaTableBorder
|
||||||
kbd
|
kbd
|
||||||
background-color themeDarkBackground
|
background-color themeDarkBackground
|
||||||
|
dl
|
||||||
|
border-color themeDarkBorder
|
||||||
|
background-color themeDraculaTableHead
|
||||||
|
dt
|
||||||
|
border-color themeDarkBorder
|
||||||
|
dd
|
||||||
|
border-color themeDarkBorder
|
||||||
|
background-color $ui-dracula-noteDetail-backgroundColor
|
||||||
|
|||||||
232
browser/lib/markdown-it-deflist.js
Normal file
232
browser/lib/markdown-it-deflist.js
Normal file
@@ -0,0 +1,232 @@
|
|||||||
|
'use strict'
|
||||||
|
|
||||||
|
module.exports = function definitionListPlugin (md) {
|
||||||
|
var isSpace = md.utils.isSpace
|
||||||
|
|
||||||
|
// Search `[:~][\n ]`, returns next pos after marker on success
|
||||||
|
// or -1 on fail.
|
||||||
|
function skipMarker (state, line) {
|
||||||
|
let start = state.bMarks[line] + state.tShift[line]
|
||||||
|
const max = state.eMarks[line]
|
||||||
|
|
||||||
|
if (start >= max) { return -1 }
|
||||||
|
|
||||||
|
// Check bullet
|
||||||
|
const marker = state.src.charCodeAt(start++)
|
||||||
|
if (marker !== 0x7E/* ~ */ && marker !== 0x3A/* : */) { return -1 }
|
||||||
|
|
||||||
|
const pos = state.skipSpaces(start)
|
||||||
|
|
||||||
|
// require space after ":"
|
||||||
|
if (start === pos) { return -1 }
|
||||||
|
|
||||||
|
return start
|
||||||
|
}
|
||||||
|
|
||||||
|
function markTightParagraphs (state, idx) {
|
||||||
|
const level = state.level + 2
|
||||||
|
|
||||||
|
let i
|
||||||
|
let l
|
||||||
|
for (i = idx + 2, l = state.tokens.length - 2; i < l; i++) {
|
||||||
|
if (state.tokens[i].level === level && state.tokens[i].type === 'paragraph_open') {
|
||||||
|
state.tokens[i + 2].hidden = true
|
||||||
|
state.tokens[i].hidden = true
|
||||||
|
i += 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function deflist (state, startLine, endLine, silent) {
|
||||||
|
var ch,
|
||||||
|
contentStart,
|
||||||
|
ddLine,
|
||||||
|
dtLine,
|
||||||
|
itemLines,
|
||||||
|
listLines,
|
||||||
|
listTokIdx,
|
||||||
|
max,
|
||||||
|
newEndLine,
|
||||||
|
nextLine,
|
||||||
|
offset,
|
||||||
|
oldDDIndent,
|
||||||
|
oldIndent,
|
||||||
|
oldLineMax,
|
||||||
|
oldParentType,
|
||||||
|
oldSCount,
|
||||||
|
oldTShift,
|
||||||
|
oldTight,
|
||||||
|
pos,
|
||||||
|
prevEmptyEnd,
|
||||||
|
tight,
|
||||||
|
token
|
||||||
|
|
||||||
|
if (silent) {
|
||||||
|
// quirk: validation mode validates a dd block only, not a whole deflist
|
||||||
|
if (state.ddIndent < 0) { return false }
|
||||||
|
return skipMarker(state, startLine) >= 0
|
||||||
|
}
|
||||||
|
|
||||||
|
nextLine = startLine + 1
|
||||||
|
if (nextLine >= endLine) { return false }
|
||||||
|
|
||||||
|
if (state.isEmpty(nextLine)) {
|
||||||
|
nextLine++
|
||||||
|
if (nextLine >= endLine) { return false }
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state.sCount[nextLine] < state.blkIndent) { return false }
|
||||||
|
contentStart = skipMarker(state, nextLine)
|
||||||
|
if (contentStart < 0) { return false }
|
||||||
|
|
||||||
|
// Start list
|
||||||
|
listTokIdx = state.tokens.length
|
||||||
|
tight = true
|
||||||
|
|
||||||
|
token = state.push('dl_open', 'dl', 1)
|
||||||
|
token.map = listLines = [ startLine, 0 ]
|
||||||
|
|
||||||
|
//
|
||||||
|
// Iterate list items
|
||||||
|
//
|
||||||
|
|
||||||
|
dtLine = startLine
|
||||||
|
ddLine = nextLine
|
||||||
|
|
||||||
|
// One definition list can contain multiple DTs,
|
||||||
|
// and one DT can be followed by multiple DDs.
|
||||||
|
//
|
||||||
|
// Thus, there is two loops here, and label is
|
||||||
|
// needed to break out of the second one
|
||||||
|
//
|
||||||
|
/* eslint no-labels:0,block-scoped-var:0 */
|
||||||
|
OUTER:
|
||||||
|
for (;;) {
|
||||||
|
prevEmptyEnd = false
|
||||||
|
|
||||||
|
token = state.push('dt_open', 'dt', 1)
|
||||||
|
token.map = [ dtLine, dtLine ]
|
||||||
|
|
||||||
|
token = state.push('inline', '', 0)
|
||||||
|
token.map = [ dtLine, dtLine ]
|
||||||
|
token.content = state.getLines(dtLine, dtLine + 1, state.blkIndent, false).trim()
|
||||||
|
token.children = []
|
||||||
|
|
||||||
|
token = state.push('dt_close', 'dt', -1)
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
token = state.push('dd_open', 'dd', 1)
|
||||||
|
token.map = itemLines = [ ddLine, 0 ]
|
||||||
|
|
||||||
|
pos = contentStart
|
||||||
|
max = state.eMarks[ddLine]
|
||||||
|
offset = state.sCount[ddLine] + contentStart - (state.bMarks[ddLine] + state.tShift[ddLine])
|
||||||
|
|
||||||
|
while (pos < max) {
|
||||||
|
ch = state.src.charCodeAt(pos)
|
||||||
|
|
||||||
|
if (isSpace(ch)) {
|
||||||
|
if (ch === 0x09) {
|
||||||
|
offset += 4 - offset % 4
|
||||||
|
} else {
|
||||||
|
offset++
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
pos++
|
||||||
|
}
|
||||||
|
|
||||||
|
contentStart = pos
|
||||||
|
|
||||||
|
oldTight = state.tight
|
||||||
|
oldDDIndent = state.ddIndent
|
||||||
|
oldIndent = state.blkIndent
|
||||||
|
oldTShift = state.tShift[ddLine]
|
||||||
|
oldSCount = state.sCount[ddLine]
|
||||||
|
oldParentType = state.parentType
|
||||||
|
state.blkIndent = state.ddIndent = state.sCount[ddLine] + 2
|
||||||
|
state.tShift[ddLine] = contentStart - state.bMarks[ddLine]
|
||||||
|
state.sCount[ddLine] = offset
|
||||||
|
state.tight = true
|
||||||
|
state.parentType = 'deflist'
|
||||||
|
|
||||||
|
newEndLine = ddLine
|
||||||
|
while (++newEndLine < endLine && (state.sCount[newEndLine] >= state.sCount[ddLine] || state.isEmpty(newEndLine))) {
|
||||||
|
}
|
||||||
|
|
||||||
|
oldLineMax = state.lineMax
|
||||||
|
state.lineMax = newEndLine
|
||||||
|
|
||||||
|
state.md.block.tokenize(state, ddLine, newEndLine, true)
|
||||||
|
|
||||||
|
state.lineMax = oldLineMax
|
||||||
|
|
||||||
|
// If any of list item is tight, mark list as tight
|
||||||
|
if (!state.tight || prevEmptyEnd) {
|
||||||
|
tight = false
|
||||||
|
}
|
||||||
|
// Item become loose if finish with empty line,
|
||||||
|
// but we should filter last element, because it means list finish
|
||||||
|
prevEmptyEnd = (state.line - ddLine) > 1 && state.isEmpty(state.line - 1)
|
||||||
|
|
||||||
|
state.tShift[ddLine] = oldTShift
|
||||||
|
state.sCount[ddLine] = oldSCount
|
||||||
|
state.tight = oldTight
|
||||||
|
state.parentType = oldParentType
|
||||||
|
state.blkIndent = oldIndent
|
||||||
|
state.ddIndent = oldDDIndent
|
||||||
|
|
||||||
|
token = state.push('dd_close', 'dd', -1)
|
||||||
|
|
||||||
|
itemLines[1] = nextLine = state.line
|
||||||
|
|
||||||
|
if (nextLine >= endLine) { break OUTER }
|
||||||
|
|
||||||
|
if (state.sCount[nextLine] < state.blkIndent) { break OUTER }
|
||||||
|
contentStart = skipMarker(state, nextLine)
|
||||||
|
if (contentStart < 0) { break }
|
||||||
|
|
||||||
|
ddLine = nextLine
|
||||||
|
|
||||||
|
// go to the next loop iteration:
|
||||||
|
// insert DD tag and repeat checking
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nextLine >= endLine) { break }
|
||||||
|
dtLine = nextLine
|
||||||
|
|
||||||
|
if (state.isEmpty(dtLine)) { break }
|
||||||
|
if (state.sCount[dtLine] < state.blkIndent) { break }
|
||||||
|
|
||||||
|
ddLine = dtLine + 1
|
||||||
|
if (ddLine >= endLine) { break }
|
||||||
|
if (state.isEmpty(ddLine)) { ddLine++ }
|
||||||
|
if (ddLine >= endLine) { break }
|
||||||
|
|
||||||
|
if (state.sCount[ddLine] < state.blkIndent) { break }
|
||||||
|
contentStart = skipMarker(state, ddLine)
|
||||||
|
if (contentStart < 0) { break }
|
||||||
|
|
||||||
|
// go to the next loop iteration:
|
||||||
|
// insert DT and DD tags and repeat checking
|
||||||
|
}
|
||||||
|
|
||||||
|
// Finilize list
|
||||||
|
token = state.push('dl_close', 'dl', -1)
|
||||||
|
|
||||||
|
listLines[1] = nextLine
|
||||||
|
|
||||||
|
state.line = nextLine
|
||||||
|
|
||||||
|
// mark paragraphs tight if needed
|
||||||
|
if (tight) {
|
||||||
|
markTightParagraphs(state, listTokIdx)
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
md.block.ruler.before('paragraph', 'deflist', deflist, { alt: [ 'paragraph', 'reference' ] })
|
||||||
|
}
|
||||||
@@ -127,8 +127,11 @@ class Markdown {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.md.use(require('markdown-it-kbd'))
|
this.md.use(require('markdown-it-kbd'))
|
||||||
|
|
||||||
this.md.use(require('markdown-it-admonition'), {types: ['note', 'hint', 'attention', 'caution', 'danger', 'error']})
|
this.md.use(require('markdown-it-admonition'), {types: ['note', 'hint', 'attention', 'caution', 'danger', 'error']})
|
||||||
|
this.md.use(require('markdown-it-abbr'))
|
||||||
|
this.md.use(require('markdown-it-sub'))
|
||||||
|
this.md.use(require('markdown-it-sup'))
|
||||||
|
this.md.use(require('./markdown-it-deflist'))
|
||||||
this.md.use(require('./markdown-it-frontmatter'))
|
this.md.use(require('./markdown-it-frontmatter'))
|
||||||
|
|
||||||
this.md.use(require('./markdown-it-fence'), {
|
this.md.use(require('./markdown-it-fence'), {
|
||||||
@@ -268,9 +271,12 @@ class Markdown {
|
|||||||
this.md.renderer.render = (tokens, options, env) => {
|
this.md.renderer.render = (tokens, options, env) => {
|
||||||
tokens.forEach((token) => {
|
tokens.forEach((token) => {
|
||||||
switch (token.type) {
|
switch (token.type) {
|
||||||
case 'heading_open':
|
|
||||||
case 'paragraph_open':
|
|
||||||
case 'blockquote_open':
|
case 'blockquote_open':
|
||||||
|
case 'dd_open':
|
||||||
|
case 'dt_open':
|
||||||
|
case 'heading_open':
|
||||||
|
case 'list_item_open':
|
||||||
|
case 'paragraph_open':
|
||||||
case 'table_open':
|
case 'table_open':
|
||||||
token.attrPush(['data-line', token.map[0]])
|
token.attrPush(['data-line', token.map[0]])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,6 +73,7 @@
|
|||||||
"lodash": "^4.11.1",
|
"lodash": "^4.11.1",
|
||||||
"lodash-move": "^1.1.1",
|
"lodash-move": "^1.1.1",
|
||||||
"markdown-it": "^6.0.1",
|
"markdown-it": "^6.0.1",
|
||||||
|
"markdown-it-abbr": "^1.0.4",
|
||||||
"markdown-it-admonition": "^1.0.4",
|
"markdown-it-admonition": "^1.0.4",
|
||||||
"markdown-it-emoji": "^1.1.1",
|
"markdown-it-emoji": "^1.1.1",
|
||||||
"markdown-it-footnote": "^3.0.0",
|
"markdown-it-footnote": "^3.0.0",
|
||||||
@@ -82,6 +83,8 @@
|
|||||||
"markdown-it-named-headers": "^0.0.4",
|
"markdown-it-named-headers": "^0.0.4",
|
||||||
"markdown-it-plantuml": "^1.1.0",
|
"markdown-it-plantuml": "^1.1.0",
|
||||||
"markdown-it-smartarrows": "^1.0.1",
|
"markdown-it-smartarrows": "^1.0.1",
|
||||||
|
"markdown-it-sub": "^1.0.0",
|
||||||
|
"markdown-it-sup": "^1.0.0",
|
||||||
"markdown-toc": "^1.2.0",
|
"markdown-toc": "^1.2.0",
|
||||||
"mdurl": "^1.0.1",
|
"mdurl": "^1.0.1",
|
||||||
"mermaid": "^8.0.0-rc.8",
|
"mermaid": "^8.0.0-rc.8",
|
||||||
|
|||||||
56
tests/fixtures/markdowns.js
vendored
56
tests/fixtures/markdowns.js
vendored
@@ -50,6 +50,58 @@ const smartQuotes = 'This is a "QUOTE".'
|
|||||||
|
|
||||||
const breaks = 'This is the first line.\nThis is the second line.'
|
const breaks = 'This is the first line.\nThis is the second line.'
|
||||||
|
|
||||||
|
const abbrevations = `
|
||||||
|
## abbr
|
||||||
|
|
||||||
|
The HTML specification
|
||||||
|
is maintained by the W3C.
|
||||||
|
|
||||||
|
*[HTML]: Hyper Text Markup Language
|
||||||
|
*[W3C]: World Wide Web Consortium
|
||||||
|
`
|
||||||
|
|
||||||
|
const subTexts = `
|
||||||
|
## sub
|
||||||
|
|
||||||
|
H~2~0
|
||||||
|
`
|
||||||
|
|
||||||
|
const supTexts = `
|
||||||
|
## sup
|
||||||
|
|
||||||
|
29^th^
|
||||||
|
`
|
||||||
|
|
||||||
|
const deflists = `
|
||||||
|
## definition list
|
||||||
|
|
||||||
|
### list 1
|
||||||
|
|
||||||
|
Term 1
|
||||||
|
~ Definition 1
|
||||||
|
|
||||||
|
Term 2
|
||||||
|
~ Definition 2a
|
||||||
|
~ Definition 2b
|
||||||
|
|
||||||
|
Term 3
|
||||||
|
~
|
||||||
|
|
||||||
|
|
||||||
|
### list 2
|
||||||
|
|
||||||
|
Term 1
|
||||||
|
|
||||||
|
: Definition 1
|
||||||
|
|
||||||
|
Term 2 with *inline markup*
|
||||||
|
|
||||||
|
: Definition 2
|
||||||
|
|
||||||
|
{ some code, part of Definition 2 }
|
||||||
|
|
||||||
|
Third paragraph of definition 2.
|
||||||
|
`
|
||||||
const shortcuts = '<kbd>Ctrl</kbd>\n\n[[Ctrl]]'
|
const shortcuts = '<kbd>Ctrl</kbd>\n\n[[Ctrl]]'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -59,5 +111,9 @@ export default {
|
|||||||
checkboxes,
|
checkboxes,
|
||||||
smartQuotes,
|
smartQuotes,
|
||||||
breaks,
|
breaks,
|
||||||
|
abbrevations,
|
||||||
|
subTexts,
|
||||||
|
supTexts,
|
||||||
|
deflists,
|
||||||
shortcuts
|
shortcuts
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,26 @@ test('Markdown.render() should render line breaks correctly', t => {
|
|||||||
t.snapshot(renderedNonBreaks)
|
t.snapshot(renderedNonBreaks)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('Markdown.render() should renders abbrevations correctly', t => {
|
||||||
|
const rendered = md.render(markdownFixtures.abbrevations)
|
||||||
|
t.snapshot(rendered)
|
||||||
|
})
|
||||||
|
|
||||||
|
test('Markdown.render() should renders sub correctly', t => {
|
||||||
|
const rendered = md.render(markdownFixtures.subTexts)
|
||||||
|
t.snapshot(rendered)
|
||||||
|
})
|
||||||
|
|
||||||
|
test('Markdown.render() should renders sup correctly', t => {
|
||||||
|
const rendered = md.render(markdownFixtures.supTexts)
|
||||||
|
t.snapshot(rendered)
|
||||||
|
})
|
||||||
|
|
||||||
|
test('Markdown.render() should renders definition lists correctly', t => {
|
||||||
|
const rendered = md.render(markdownFixtures.deflists)
|
||||||
|
t.snapshot(rendered)
|
||||||
|
})
|
||||||
|
|
||||||
test('Markdown.render() should render shortcuts correctly', t => {
|
test('Markdown.render() should render shortcuts correctly', t => {
|
||||||
const rendered = md.render(markdownFixtures.shortcuts)
|
const rendered = md.render(markdownFixtures.shortcuts)
|
||||||
t.snapshot(rendered)
|
t.snapshot(rendered)
|
||||||
|
|||||||
@@ -33,13 +33,22 @@ Generated by [AVA](https://ava.li).
|
|||||||
`<span class="katex-display"><span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>c</mi><mo>=</mo><mi>p</mi><mi>m</mi><mi>s</mi><mi>q</mi><mi>r</mi><mi>t</mi><mrow><msup><mi>a</mi><mn>2</mn></msup><mo>+</mo><msup><mi>b</mi><mn>2</mn></msup></mrow></mrow><annotation encoding="application/x-tex">c = pmsqrt{a^2 + b^2}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.8641079999999999em;"></span><span class="strut bottom" style="height:1.0585479999999998em;vertical-align:-0.19444em;"></span><span class="base"><span class="mord mathit">c</span><span class="mord rule" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span><span class="mord rule" style="margin-right:0.2777777777777778em;"></span><span class="mord mathit">p</span><span class="mord mathit">m</span><span class="mord mathit">s</span><span class="mord mathit" style="margin-right:0.03588em;">q</span><span class="mord mathit" style="margin-right:0.02778em;">r</span><span class="mord mathit">t</span><span class="mord"><span class="mord"><span class="mord mathit">a</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8641079999999999em;"><span style="top:-3.113em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span><span class="mord rule" style="margin-right:0.2222222222222222em;"></span><span class="mbin">+</span><span class="mord rule" style="margin-right:0.2222222222222222em;"></span><span class="mord"><span class="mord mathit">b</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8641079999999999em;"><span style="top:-3.113em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span></span></span></span></span></span>␊
|
`<span class="katex-display"><span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>c</mi><mo>=</mo><mi>p</mi><mi>m</mi><mi>s</mi><mi>q</mi><mi>r</mi><mi>t</mi><mrow><msup><mi>a</mi><mn>2</mn></msup><mo>+</mo><msup><mi>b</mi><mn>2</mn></msup></mrow></mrow><annotation encoding="application/x-tex">c = pmsqrt{a^2 + b^2}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.8641079999999999em;"></span><span class="strut bottom" style="height:1.0585479999999998em;vertical-align:-0.19444em;"></span><span class="base"><span class="mord mathit">c</span><span class="mord rule" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span><span class="mord rule" style="margin-right:0.2777777777777778em;"></span><span class="mord mathit">p</span><span class="mord mathit">m</span><span class="mord mathit">s</span><span class="mord mathit" style="margin-right:0.03588em;">q</span><span class="mord mathit" style="margin-right:0.02778em;">r</span><span class="mord mathit">t</span><span class="mord"><span class="mord"><span class="mord mathit">a</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8641079999999999em;"><span style="top:-3.113em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span><span class="mord rule" style="margin-right:0.2222222222222222em;"></span><span class="mbin">+</span><span class="mord rule" style="margin-right:0.2222222222222222em;"></span><span class="mord"><span class="mord mathit">b</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8641079999999999em;"><span style="top:-3.113em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span></span></span></span></span></span>␊
|
||||||
`
|
`
|
||||||
|
|
||||||
|
## Markdown.render() should renders abbrevations correctly
|
||||||
|
|
||||||
|
> Snapshot 1
|
||||||
|
|
||||||
|
`<h2 data-line="1" id="abbr">abbr</h2>␊
|
||||||
|
<p data-line="3">The <abbr title="Hyper Text Markup Language">HTML</abbr> specification<br />␊
|
||||||
|
is maintained by the <abbr title="World Wide Web Consortium">W3C</abbr>.</p>␊
|
||||||
|
`
|
||||||
|
|
||||||
## Markdown.render() should renders checkboxes
|
## Markdown.render() should renders checkboxes
|
||||||
|
|
||||||
> Snapshot 1
|
> Snapshot 1
|
||||||
|
|
||||||
`<ul>␊
|
`<ul>␊
|
||||||
<li class="taskListItem"><input type="checkbox" id="checkbox-2" /> Unchecked</li>␊
|
<li class="taskListItem" data-line="1"><input type="checkbox" id="checkbox-2" /> Unchecked</li>␊
|
||||||
<li class="taskListItem checked"><input type="checkbox" checked id="checkbox-3" /> Checked</li>␊
|
<li class="taskListItem checked" data-line="2"><input type="checkbox" checked id="checkbox-3" /> Checked</li>␊
|
||||||
</ul>␊
|
</ul>␊
|
||||||
`
|
`
|
||||||
|
|
||||||
@@ -54,6 +63,37 @@ Generated by [AVA](https://ava.li).
|
|||||||
</code>␊
|
</code>␊
|
||||||
</pre>`
|
</pre>`
|
||||||
|
|
||||||
|
## Markdown.render() should renders definition lists correctly
|
||||||
|
|
||||||
|
> Snapshot 1
|
||||||
|
|
||||||
|
`<h2 data-line="1" id="definition-list">definition list</h2>␊
|
||||||
|
<h3 data-line="3" id="list-1">list 1</h3>␊
|
||||||
|
<dl>␊
|
||||||
|
<dt data-line="5">Term 1</dt>␊
|
||||||
|
<dd data-line="6">Definition 1</dd>␊
|
||||||
|
<dt data-line="8">Term 2</dt>␊
|
||||||
|
<dd data-line="9">Definition 2a</dd>␊
|
||||||
|
<dd data-line="10">Definition 2b</dd>␊
|
||||||
|
</dl>␊
|
||||||
|
<p data-line="12">Term 3<br />␊
|
||||||
|
~</p>␊
|
||||||
|
<h3 data-line="16" id="list-2">list 2</h3>␊
|
||||||
|
<dl>␊
|
||||||
|
<dt data-line="18">Term 1</dt>␊
|
||||||
|
<dd data-line="20">␊
|
||||||
|
<p data-line="20">Definition 1</p>␊
|
||||||
|
</dd>␊
|
||||||
|
<dt data-line="22">Term 2 with <em>inline markup</em></dt>␊
|
||||||
|
<dd data-line="24">␊
|
||||||
|
<p data-line="24">Definition 2</p>␊
|
||||||
|
<pre><code> { some code, part of Definition 2 }␊
|
||||||
|
</code></pre>␊
|
||||||
|
<p data-line="28">Third paragraph of definition 2.</p>␊
|
||||||
|
</dd>␊
|
||||||
|
</dl>␊
|
||||||
|
`
|
||||||
|
|
||||||
## Markdown.render() should renders markdown correctly
|
## Markdown.render() should renders markdown correctly
|
||||||
|
|
||||||
> Snapshot 1
|
> Snapshot 1
|
||||||
@@ -63,31 +103,47 @@ Generated by [AVA](https://ava.li).
|
|||||||
<iframe width="560" height="315" src="https://www.youtube.com/embed/L0qNPLsvmyM" frameborder="0" allowfullscreen></iframe>␊
|
<iframe width="560" height="315" src="https://www.youtube.com/embed/L0qNPLsvmyM" frameborder="0" allowfullscreen></iframe>␊
|
||||||
<h2 data-line="6" id="Docs-%F0%9F%93%9D">Docs 📝</h2>␊
|
<h2 data-line="6" id="Docs-%F0%9F%93%9D">Docs 📝</h2>␊
|
||||||
<ul>␊
|
<ul>␊
|
||||||
<li><a href="https://hackernoon.com/boostnote-boost-your-happiness-productivity-and-creativity-315034efeebe">Boostnote | Boost your happiness, productivity and creativity.</a></li>␊
|
<li data-line="7"><a href="https://hackernoon.com/boostnote-boost-your-happiness-productivity-and-creativity-315034efeebe">Boostnote | Boost your happiness, productivity and creativity.</a></li>␊
|
||||||
<li><a href="https://github.com/BoostIO/Boostnote/wiki/Cloud-Syncing-and-Backup">Cloud Syncing & Backups</a></li>␊
|
<li data-line="8"><a href="https://github.com/BoostIO/Boostnote/wiki/Cloud-Syncing-and-Backup">Cloud Syncing & Backups</a></li>␊
|
||||||
<li><a href="https://github.com/BoostIO/Boostnote/wiki/Sync-Data-Across-Desktop-and-Mobile-apps">How to sync your data across Desktop and Mobile apps</a></li>␊
|
<li data-line="9"><a href="https://github.com/BoostIO/Boostnote/wiki/Sync-Data-Across-Desktop-and-Mobile-apps">How to sync your data across Desktop and Mobile apps</a></li>␊
|
||||||
<li><a href="https://github.com/BoostIO/Boostnote/wiki/Evernote">Convert data from <strong>Evernote</strong> to Boostnote.</a></li>␊
|
<li data-line="10"><a href="https://github.com/BoostIO/Boostnote/wiki/Evernote">Convert data from <strong>Evernote</strong> to Boostnote.</a></li>␊
|
||||||
<li><a href="https://github.com/BoostIO/Boostnote/wiki/Keyboard-Shortcuts">Keyboard Shortcuts</a></li>␊
|
<li data-line="11"><a href="https://github.com/BoostIO/Boostnote/wiki/Keyboard-Shortcuts">Keyboard Shortcuts</a></li>␊
|
||||||
<li><a href="https://github.com/BoostIO/Boostnote/wiki/Keymaps-in-Editor-mode">Keymaps in Editor mode</a></li>␊
|
<li data-line="12"><a href="https://github.com/BoostIO/Boostnote/wiki/Keymaps-in-Editor-mode">Keymaps in Editor mode</a></li>␊
|
||||||
<li><a href="https://github.com/BoostIO/Boostnote/wiki/Syntax-Highlighting">How to set syntax highlight in Snippet note</a></li>␊
|
<li data-line="13"><a href="https://github.com/BoostIO/Boostnote/wiki/Syntax-Highlighting">How to set syntax highlight in Snippet note</a></li>␊
|
||||||
</ul>␊
|
</ul>␊
|
||||||
<hr />␊
|
<hr />␊
|
||||||
<h2 data-line="17" id="Article-Archive-%F0%9F%93%9A">Article Archive 📚</h2>␊
|
<h2 data-line="17" id="Article-Archive-%F0%9F%93%9A">Article Archive 📚</h2>␊
|
||||||
<ul>␊
|
<ul>␊
|
||||||
<li><a href="http://bit.ly/2mOJPu7">Reddit English</a></li>␊
|
<li data-line="18"><a href="http://bit.ly/2mOJPu7">Reddit English</a></li>␊
|
||||||
<li><a href="https://www.reddit.com/r/boostnote_es/">Reddit Spanish</a></li>␊
|
<li data-line="19"><a href="https://www.reddit.com/r/boostnote_es/">Reddit Spanish</a></li>␊
|
||||||
<li><a href="https://www.reddit.com/r/boostnote_cn/">Reddit Chinese</a></li>␊
|
<li data-line="20"><a href="https://www.reddit.com/r/boostnote_cn/">Reddit Chinese</a></li>␊
|
||||||
<li><a href="https://www.reddit.com/r/boostnote_jp/">Reddit Japanese</a></li>␊
|
<li data-line="21"><a href="https://www.reddit.com/r/boostnote_jp/">Reddit Japanese</a></li>␊
|
||||||
</ul>␊
|
</ul>␊
|
||||||
<hr />␊
|
<hr />␊
|
||||||
<h2 data-line="25" id="Community-%F0%9F%8D%BB">Community 🍻</h2>␊
|
<h2 data-line="25" id="Community-%F0%9F%8D%BB">Community 🍻</h2>␊
|
||||||
<ul>␊
|
<ul>␊
|
||||||
<li><a href="http://bit.ly/2AWWzkD">GitHub</a></li>␊
|
<li data-line="26"><a href="http://bit.ly/2AWWzkD">GitHub</a></li>␊
|
||||||
<li><a href="http://bit.ly/2z8BUJZ">Twitter</a></li>␊
|
<li data-line="27"><a href="http://bit.ly/2z8BUJZ">Twitter</a></li>␊
|
||||||
<li><a href="http://bit.ly/2jcca8t">Facebook Group</a></li>␊
|
<li data-line="28"><a href="http://bit.ly/2jcca8t">Facebook Group</a></li>␊
|
||||||
</ul>␊
|
</ul>␊
|
||||||
`
|
`
|
||||||
|
|
||||||
|
## Markdown.render() should renders sub correctly
|
||||||
|
|
||||||
|
> Snapshot 1
|
||||||
|
|
||||||
|
`<h2 data-line="1" id="sub">sub</h2>␊
|
||||||
|
<p data-line="3">H<sub>2</sub>0</p>␊
|
||||||
|
`
|
||||||
|
|
||||||
|
## Markdown.render() should renders sup correctly
|
||||||
|
|
||||||
|
> Snapshot 1
|
||||||
|
|
||||||
|
`<h2 data-line="1" id="sup">sup</h2>␊
|
||||||
|
<p data-line="3">29<sup>th</sup></p>␊
|
||||||
|
`
|
||||||
|
|
||||||
## Markdown.render() should text with quotes correctly
|
## Markdown.render() should text with quotes correctly
|
||||||
|
|
||||||
> Snapshot 1
|
> Snapshot 1
|
||||||
|
|||||||
Binary file not shown.
12
yarn.lock
12
yarn.lock
@@ -5848,6 +5848,10 @@ map-visit@^1.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
object-visit "^1.0.0"
|
object-visit "^1.0.0"
|
||||||
|
|
||||||
|
markdown-it-abbr@^1.0.4:
|
||||||
|
version "1.0.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/markdown-it-abbr/-/markdown-it-abbr-1.0.4.tgz#d66b5364521cbb3dd8aa59dadfba2fb6865c8fd8"
|
||||||
|
|
||||||
markdown-it-admonition@^1.0.4:
|
markdown-it-admonition@^1.0.4:
|
||||||
version "1.0.4"
|
version "1.0.4"
|
||||||
resolved "https://registry.yarnpkg.com/markdown-it-admonition/-/markdown-it-admonition-1.0.4.tgz#d7bbc7eb1fe6168fc8cc304de7a9d8c993acb2f5"
|
resolved "https://registry.yarnpkg.com/markdown-it-admonition/-/markdown-it-admonition-1.0.4.tgz#d7bbc7eb1fe6168fc8cc304de7a9d8c993acb2f5"
|
||||||
@@ -5888,6 +5892,14 @@ markdown-it-smartarrows@^1.0.1:
|
|||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/markdown-it-smartarrows/-/markdown-it-smartarrows-1.0.1.tgz#b570e9c0ff9812e0db6ace19afa5ba12b64bb9a7"
|
resolved "https://registry.yarnpkg.com/markdown-it-smartarrows/-/markdown-it-smartarrows-1.0.1.tgz#b570e9c0ff9812e0db6ace19afa5ba12b64bb9a7"
|
||||||
|
|
||||||
|
markdown-it-sub@^1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/markdown-it-sub/-/markdown-it-sub-1.0.0.tgz#375fd6026eae7ddcb012497f6411195ea1e3afe8"
|
||||||
|
|
||||||
|
markdown-it-sup@^1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/markdown-it-sup/-/markdown-it-sup-1.0.0.tgz#cb9c9ff91a5255ac08f3fd3d63286e15df0a1fc3"
|
||||||
|
|
||||||
markdown-it@^5.0.3:
|
markdown-it@^5.0.3:
|
||||||
version "5.1.0"
|
version "5.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-5.1.0.tgz#25286b8465bac496f3f1b77eed544643e9bd718d"
|
resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-5.1.0.tgz#25286b8465bac496f3f1b77eed544643e9bd718d"
|
||||||
|
|||||||
Reference in New Issue
Block a user