mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
Merge pull request #2863 from zzdjk6/master
FIX #2853 Allow "#" in title
This commit is contained in:
@@ -22,7 +22,7 @@ export function strip (input) {
|
|||||||
.replace(/\[(.*?)\][\[\(].*?[\]\)]/g, '$1')
|
.replace(/\[(.*?)\][\[\(].*?[\]\)]/g, '$1')
|
||||||
.replace(/>/g, '')
|
.replace(/>/g, '')
|
||||||
.replace(/^\s{1,2}\[(.*?)\]: (\S+)( ".*?")?\s*$/g, '')
|
.replace(/^\s{1,2}\[(.*?)\]: (\S+)( ".*?")?\s*$/g, '')
|
||||||
.replace(/^#{1,6}\s*([^#]*)\s*(#{1,6})?/gm, '$1')
|
.replace(/^#{1,6}\s*/gm, '')
|
||||||
.replace(/(`{3,})(.*?)\1/gm, '$2')
|
.replace(/(`{3,})(.*?)\1/gm, '$2')
|
||||||
.replace(/^-{3,}\s*$/g, '')
|
.replace(/^-{3,}\s*$/g, '')
|
||||||
.replace(/`(.+?)`/g, '$1')
|
.replace(/`(.+?)`/g, '$1')
|
||||||
|
|||||||
@@ -100,7 +100,12 @@ class MarkdownNoteDetail extends React.Component {
|
|||||||
handleUpdateContent () {
|
handleUpdateContent () {
|
||||||
const { note } = this.state
|
const { note } = this.state
|
||||||
note.content = this.refs.content.value
|
note.content = this.refs.content.value
|
||||||
note.title = markdown.strip(striptags(findNoteTitle(note.content, this.props.config.editor.enableFrontMatterTitle, this.props.config.editor.frontMatterTitleField)))
|
|
||||||
|
let title = findNoteTitle(note.content, this.props.config.editor.enableFrontMatterTitle, this.props.config.editor.frontMatterTitleField)
|
||||||
|
title = striptags(title)
|
||||||
|
title = markdown.strip(title)
|
||||||
|
note.title = title
|
||||||
|
|
||||||
this.updateNote(note)
|
this.updateNote(note)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,8 @@ test(t => {
|
|||||||
['`MY_TITLE`', 'MY_TITLE'],
|
['`MY_TITLE`', 'MY_TITLE'],
|
||||||
['MY_TITLE', 'MY_TITLE'],
|
['MY_TITLE', 'MY_TITLE'],
|
||||||
// I have no idea for it...
|
// I have no idea for it...
|
||||||
['```test', '`test']
|
['```test', '`test'],
|
||||||
|
['# C# Features', 'C# Features']
|
||||||
]
|
]
|
||||||
|
|
||||||
testCases.forEach(testCase => {
|
testCases.forEach(testCase => {
|
||||||
|
|||||||
Reference in New Issue
Block a user