From 473cc01a81f7737086b8ec6e0188c09e5fa94543 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Jonathan=20Ordo=C3=B1ez?= <122837587+eluisjonathann@users.noreply.github.com> Date: Sat, 13 Jun 2026 08:26:51 -0500 Subject: [PATCH] Add files via upload --- LICENSE | 21 +++++++++++++++++++++ README.md | 13 +++++++++++++ main.js | 30 ++++++++++++++++++++++++++++++ manifest.json | 10 ++++++++++ 4 files changed, 74 insertions(+) create mode 100644 LICENSE create mode 100644 README.md create mode 100644 main.js create mode 100644 manifest.json diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..5f5018a --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Luis Jonathan O.R + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..3fb6c62 --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +# Remove Task Format for Obsidian + +¡Holaa a todos Este es mi primer plugin de Obsidian. Lo creé porque me frustraba tener que borrar a mano los corchetes `[ ]` o `[x]` cuando quería convertir una tarea de vuelta a una viñeta normal (`- `) en una línea específica, sin tener que usar buscar y reemplazar en todo el archivo. + +## Qué hace +Añade un comando simple para quitar el formato de tarea de la línea donde tengas el cursor, manteniendo tu indentación y viñetas originales. + +## Cómo usarlo +1. Instala el plugin. +2. Ve a Configuración > Atajos de teclado (Hotkeys). +3. Busca `Remove task format from current line`. +4. Asigna el atajo que prefieras (por ejemplo, `Ctrl+Shift+L`). +5. Presiona el atajo sobre cualquier tarea (`- [ ] tarea` o `- [x] tarea`) y se convertirá de vuelta a una lista normal (`- tarea`). diff --git a/main.js b/main.js new file mode 100644 index 0000000..59b5ffb --- /dev/null +++ b/main.js @@ -0,0 +1,30 @@ +const { Plugin } = require('obsidian'); + +module.exports = class RemoveTaskPlugin extends Plugin { + async onload() { + this.addCommand({ + id: 'remove-task-format', + name: 'Remove task format from current line', + editorCallback: (editor, view) => { + const cursor = editor.getCursor(); + const lineText = editor.getLine(cursor.line); + + // Matches optional list marker (e.g. - or * or 1.) followed by checkbox e.g. [ ] or [x] + const taskRegex = /^(\s*[-*+]|\s*\d+\.)?\s*\[[xX ]\]\s*(.*)$/; + + if (taskRegex.test(lineText)) { + // Replaces the checkbox but keeps the indentation/list marker and the text + // If there's a list marker, we keep it. If there was none, it becomes plain text. + const newLineText = lineText.replace(taskRegex, (match, prefix, content) => { + if (prefix) { + return `${prefix} ${content}`; + } else { + return content; + } + }); + editor.setLine(cursor.line, newLineText); + } + } + }); + } +} diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..90a48be --- /dev/null +++ b/manifest.json @@ -0,0 +1,10 @@ +{ + "id": "obsidian-remove-task-format", + "name": "Remove Task Format", + "version": "1.0.0", + "minAppVersion": "0.15.0", + "description": "Quita el formato de tarea ([ ] o [x]) de la línea actual con un atajo de teclado.", + "author": "eluisjonathan", + "authorUrl": "https://github.com/eluisjonathann", + "isDesktopOnly": false +}