Skip to content

Recursive/nesting rewrite #382

@Ruecker7739

Description

@Ruecker7739

The title is more of a possible solution to my problem. But let's start with the problem first:

I have a markdown with unnecessary indententation like below:

# Heading 1
    - Content 1
        - Content 2
# Heading 2
    - Some Content

I want to remove the indentation in the content:

diff --git a/before b/after
index 711b728..dbbd285 100644
--- a/before
+++ b/after
@@ -1,6 +1,6 @@
 # Heading 1
-    - Content 1
-        - Content 2
+- Content 1
+    - Content 2
 # Heading 2
-    - Some Content
+- Some Content
 

I think I'm almost there, with the following pattern:

comby '#:[heading\n]:[content]#' '<rewrite_template>' markdown.md -matcher txt

Now the content is captured but I am not aware of any way to remove the indententation.

It would be great if there was already such a capability. But if not, the solution I'm thinking of is, to add support for something like nesting rewrite. That is, to allow the captured text (in this case, :[content]) to be processed by another comby command (in this case, the nesting command would replace leading tab/spaces at each line with an empty string).

What is your take?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions