Merge pull request #23 from rioskit/feat/#12

feat/#12
This commit is contained in:
Riosk It 2025-07-08 08:25:14 +09:00 committed by GitHub
commit fa3c69e9a8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 23 additions and 7 deletions

View file

@ -1,7 +1,7 @@
{
"id": "todo-txt-mode",
"name": "Todo.txt Mode",
"version": "1.0.4",
"version": "1.0.5",
"minAppVersion": "1.8.0",
"description": "Support for todo.txt file format with syntax highlighting and task management",
"author": "Riosk It",

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "obsidian-todo-txt-mode",
"version": "1.0.4",
"version": "1.0.5",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "obsidian-todo-txt-mode",
"version": "1.0.4",
"version": "1.0.5",
"license": "MIT",
"devDependencies": {
"@types/jest": "^30.0.0",

View file

@ -1,6 +1,6 @@
{
"name": "obsidian-todo-txt-mode",
"version": "1.0.4",
"version": "1.0.5",
"description": "Support for todo.txt file format with syntax highlighting and task management",
"main": "main.js",
"scripts": {

View file

@ -37,7 +37,8 @@ const mockSettings: TodoTxtSettings = {
recurringTaskColor: '#FF5722',
enableRecurringTasks: true,
enableAutoCompletionDate: true,
enableRecurringTaskCreationDate: false
enableRecurringTaskCreationDate: false,
highlightDoneFile: true
};
const mockIsTodoTxtFile = (path: string) => path === 'todo.md';
const mockGetSettings = () => mockSettings;

View file

@ -41,6 +41,7 @@ export interface TodoTxtSettings {
enableRecurringTasks: boolean;
enableAutoCompletionDate: boolean;
enableRecurringTaskCreationDate: boolean;
highlightDoneFile: boolean;
}
export const DEFAULT_SETTINGS: TodoTxtSettings = {
@ -75,7 +76,8 @@ export const DEFAULT_SETTINGS: TodoTxtSettings = {
enableRecurringTasks: true,
enableAutoCompletionDate: true,
enableRecurringTaskCreationDate: false
enableRecurringTaskCreationDate: false,
highlightDoneFile: true
}
export class TodoTxtSettingTab extends PluginSettingTab {
@ -176,6 +178,13 @@ export class TodoTxtSettingTab extends PluginSettingTab {
'doneFilePath'
);
this.createHighlightSetting(
containerEl,
'Highlight done file',
'Apply syntax highlighting to completed tasks file',
'highlightDoneFile'
);
new Setting(containerEl).setHeading().setName('Highlighting');
const styleSettingsInfo = containerEl.createEl('div', {

View file

@ -35,6 +35,11 @@ export function createTodoTxtExtension(app: App, isTodoTxtFile: (path: string) =
return Decoration.none;
}
// Check if highlighting is disabled for done file
if (file.path === settings.doneFilePath && !settings.highlightDoneFile) {
return Decoration.none;
}
if (file.path !== this.lastFile) {
this.lastFile = file.path;
}

View file

@ -3,5 +3,6 @@
"1.0.1": "1.8.0",
"1.0.2": "1.8.0",
"1.0.3": "1.8.0",
"1.0.4": "1.8.0"
"1.0.4": "1.8.0",
"1.0.5": "1.8.0"
}