Skip to content

Commit

Permalink
Remove all Markdown chars from title when sorting entries
Browse files Browse the repository at this point in the history
  • Loading branch information
kyoshino committed Nov 11, 2024
1 parent f9a8cbf commit 18c9254
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib/services/contents/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ const defaultSortableFields = ['title', 'name', 'date', 'author', 'description']
export const currentView = writable({ type: 'list' });

/**
* Remove some Markdown syntax characters at the beginning of the string for proper sorting. This
* includes bold, italic and code that are parsed if included in the entry summary/title.
* Remove some Markdown syntax characters from the given string for proper sorting. This includes
* bold, italic and code that might appear in the entry title.
* @param {string} str - Original string.
* @returns {string} Modified string.
*/
const removeMarkdownChars = (str) => str.replace(/^[_*`]+/, '');
const removeMarkdownChars = (str) => str.replace(/[_*`]+/g, '');

/**
* Sort the given entries.
Expand Down

0 comments on commit 18c9254

Please sign in to comment.