fix: Better markdown conversion for Hypermind questions
This commit is contained in:
parent
1fd3b29def
commit
3c0a01db95
|
@ -35,4 +35,4 @@ export async function rebuildAlgoliaDatabaseTheEasyWay(){
|
|||
}
|
||||
}
|
||||
|
||||
export const rebuildAlgoliaDatabase = rebuildAlgoliaDatabaseTheHardWay
|
||||
export const rebuildAlgoliaDatabase = rebuildAlgoliaDatabaseTheEasyWay//rebuildAlgoliaDatabaseTheHardWay
|
|
@ -2,6 +2,8 @@
|
|||
import textVersion from "textversionjs"
|
||||
|
||||
/* Definitions */
|
||||
String.prototype.replaceAll = function replaceAll(search, replace) { return this.split(search).join(replace); }
|
||||
|
||||
var styleConfig = {
|
||||
linkProcess: function(href, linkText){
|
||||
let newHref = href ? href.replace(/\(/g, "%28").replace(/\)/g, "%29") : ""
|
||||
|
@ -15,7 +17,9 @@ var styleConfig = {
|
|||
/* Body */
|
||||
|
||||
export default function toMarkdown(htmlText){
|
||||
return textVersion(htmlText, styleConfig);
|
||||
let html2 = htmlText.replaceAll(`='`, `="`).replaceAll(`'>`, `">`)
|
||||
return textVersion(html2, styleConfig);
|
||||
}
|
||||
|
||||
// toMarkdown()
|
||||
// console.log(toMarkdown("Context:Many intellectual endeavors require mathematical problem solving, but this skill remains beyond the capabilities of computers. To help advance the art, the <a target=_new href='https://github.com/hendrycks/math/'>MATH</a> dataset offers..."))
|
||||
|
|
Loading…
Reference in New Issue
Block a user