mirror of
https://github.com/eluisjonathann/obsidian-remove-task-format.git
synced 2026-07-22 07:45:27 +00:00
Add files via upload
This commit is contained in:
parent
6d578dcde8
commit
473cc01a81
4 changed files with 74 additions and 0 deletions
21
LICENSE
Normal file
21
LICENSE
Normal file
|
|
@ -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.
|
||||
13
README.md
Normal file
13
README.md
Normal file
|
|
@ -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`).
|
||||
30
main.js
Normal file
30
main.js
Normal file
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
10
manifest.json
Normal file
10
manifest.json
Normal file
|
|
@ -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
|
||||
}
|
||||
Loading…
Reference in a new issue