Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ module.exports = {
rules: {
'@typescript-eslint/unbound-method': 'error',
'no-unused-vars': 'off',
'@typescript-eslint/no-unsafe-assignment': 'warn',
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be preferable to avoid changing the severity of this rule. Using any disables many type checking rules and changing this severity will lead to a lot of backsliding and build up of these errors/warnings.

'@typescript-eslint/no-unused-vars': [
'error',
{
Expand Down
211 changes: 191 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"typescript": "^5.4.5"
},
"dependencies": {
"@aidenlx/obsidian-icon-shortcodes": "0.9.0",
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like this project may be inactive/unmaintained, the last commit was from October 2022..?

"ts-deepmerge": "^7.0.1"
}
}
15 changes: 13 additions & 2 deletions src/Handlers/headingsHandler.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { getApi as getIconShortcodesApi } from '@aidenlx/obsidian-icon-shortcodes';
import { Handler } from './handler';
import { StandardExHandler } from './standardExHandler';
import { EditorHandler } from './editorHandler';
Expand Down Expand Up @@ -168,13 +169,23 @@ export class HeadingsHandler extends Handler<SupportedSuggestionTypes> {
renderMarkdownContentInSuggestions: { isEnabled, renderHeadings },
} = config;

let headingText = heading;
const iconShortcodesApi = getIconShortcodesApi();

if (iconShortcodesApi) {
headingText = iconShortcodesApi.postProcessor(headingText, (iconText: string) => {
const iconResult = iconShortcodesApi.getIcon(iconText).innerText;
return iconResult ?? iconText;
});
}

// If the override is null or undefined, fallback to the config value
renderAsHTMLOverride = renderAsHTMLOverride ?? (isEnabled && renderHeadings);

if (renderAsHTMLOverride) {
Handler.renderMarkdownContentAsync(app, titleEl, heading, sourceFile.path);
Handler.renderMarkdownContentAsync(app, titleEl, headingText, sourceFile.path);
} else {
renderResults(titleEl, heading, searchResult);
renderResults(titleEl, headingText, searchResult);
}
}

Expand Down