mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Add makeHighlightedResultTitle helper
This commit is contained in:
parent
ef15f12198
commit
c9639e0f57
1 changed files with 17 additions and 0 deletions
|
|
@ -1,4 +1,6 @@
|
||||||
|
|
||||||
|
import { isString } from '~/helpers/check-types.js'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
storkIndexRelativeURL,
|
storkIndexRelativeURL,
|
||||||
storkScriptURL
|
storkScriptURL
|
||||||
|
|
@ -44,6 +46,21 @@ export function makeHighlightedMarkup ( options = {} ) {
|
||||||
return highlighted_text
|
return highlighted_text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function makeHighlightedResultTitle ( result ) {
|
||||||
|
const [ highlightedTitleMarkup ] = makeHighlightedMarkup({
|
||||||
|
text: result.entry.title,
|
||||||
|
highlight_ranges: result.title_highlight_ranges,
|
||||||
|
withElipsis: false
|
||||||
|
})
|
||||||
|
|
||||||
|
console.log('highlightedTitleMarkup', highlightedTitleMarkup)
|
||||||
|
console.log('result', result)
|
||||||
|
|
||||||
|
if ( !isString( highlightedTitleMarkup ) ) throw new Error('highlightedTitleMarkup is not a string')
|
||||||
|
|
||||||
|
return highlightedTitleMarkup
|
||||||
|
}
|
||||||
|
|
||||||
export class StorkClient {
|
export class StorkClient {
|
||||||
constructor ( options = {} ) {
|
constructor ( options = {} ) {
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue