SimpleChatTCRV:Markdown: Allow fixed spaces b4 fenced pre marker
This commit is contained in:
parent
95c8cd6eba
commit
03220d4a2b
|
|
@ -299,6 +299,7 @@ Chat Session specific settings
|
||||||
* More flexibility to user wrt ExternalAi tool call ie ai calling ai
|
* More flexibility to user wrt ExternalAi tool call ie ai calling ai
|
||||||
* the user can change the default behaviour of tools being disabled and sliding window of 1
|
* the user can change the default behaviour of tools being disabled and sliding window of 1
|
||||||
* program restart will reset these back to the default
|
* program restart will reset these back to the default
|
||||||
|
* A simple minded basic Markdown to Html logic
|
||||||
|
|
||||||
|
|
||||||
## ToDo
|
## ToDo
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,8 @@ export class MarkDown {
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// 3 or more of --- or ___ or *** followed by space
|
||||||
|
// some online notes seemed to indicate spaces at end, so accepting same
|
||||||
if (line.match(/^[-]{3,}|[*]{3,}|[_]{3,}\s*$/) != null) {
|
if (line.match(/^[-]{3,}|[*]{3,}|[_]{3,}\s*$/) != null) {
|
||||||
this.unwind_list()
|
this.unwind_list()
|
||||||
this.html += "<hr>\n"
|
this.html += "<hr>\n"
|
||||||
|
|
@ -54,13 +56,16 @@ export class MarkDown {
|
||||||
this.html += `<h${hLevel}>${line.slice(hLevel)}</h${hLevel}>\n`
|
this.html += `<h${hLevel}>${line.slice(hLevel)}</h${hLevel}>\n`
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let matchPreFenced = line.match(/^(```|~~~)([a-zA-Z0-9]*)(.*)/);
|
// same number of space followed by ``` or ~~~
|
||||||
|
// some samples with spaces at beginning seen, so accepting spaces at begin
|
||||||
|
let matchPreFenced = line.match(/^(\s*```|\s*~~~)([a-zA-Z0-9]*)(.*)/);
|
||||||
if ( matchPreFenced != null) {
|
if ( matchPreFenced != null) {
|
||||||
this.unwind_list()
|
this.unwind_list()
|
||||||
this.in.preFenced = matchPreFenced[1]
|
this.in.preFenced = matchPreFenced[1]
|
||||||
this.html += `<pre class="${matchPreFenced[2]}">\n`
|
this.html += `<pre class="${matchPreFenced[2]}">\n`
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// spaces followed by - or + or * followed by a space and actual list item
|
||||||
let matchUnOrdered = line.match(/^([ ]*)[-+*][ ](.*)$/);
|
let matchUnOrdered = line.match(/^([ ]*)[-+*][ ](.*)$/);
|
||||||
if ( matchUnOrdered != null) {
|
if ( matchUnOrdered != null) {
|
||||||
let sList = 'none'
|
let sList = 'none'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue