Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recursive/nesting rewrite #382

Open
Ruecker7739 opened this issue Nov 16, 2024 · 0 comments
Open

Recursive/nesting rewrite #382

Ruecker7739 opened this issue Nov 16, 2024 · 0 comments

Comments

@Ruecker7739
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant