PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: sveltejs/prettier-plugin-svelte (ts)

Issue:
Don't append trailing newline when parsing markdown code blocks
Every other code block formatter (tested with `ts`, `js`, and `html`) leaves the fenced code blocks with no trailing newlines, but this one appends a trailing newline, which is therefore out of place and distracting. It would be great if this could leave 0 trailing newlines in these fenced blocks.

EDIT: namely, remove line 20 of test/printer/samples/markdown.md.

Pull request:
(fix) no empty line at the end of markdown embed
Prettier's markdown parser tries to strip the last hardline of the embedded docs, but fails to do so in our case because it does not recurse into concat parts -> we need to strip it ourselves.
Fixes #202

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4518d55..937c57f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
 # prettier-plugin-svelte changelog
 
+## 2.1.3 (Unreleased)
+
+* Don't print empty line at the end of the code if embedded inside markdown ([#202](https://github.com/sveltejs/prettier-plugin-svelte/issues/202))
+
 ## 2.1.2
 
 * Keep whitespace around `<script>`/`<style>` tags ([#197](https://github.com/sveltejs/prettier-plugin-svelte/issues/197))
diff --git a/src/print/index.ts b/src/print/index.ts
index 255641a..8e83e1d 100644
--- a/src/print/index.ts
+++ b/src/print/index.ts
@@ -4,7 +4,7 @@ import { extractAttributes } from '../lib/extractAttributes';
 import { getText } from '../lib/getText';
 import { hasSnippedContent, unsnipContent } from '../lib/snipTagContent';
 import { parseSortOrder, SortOrderPart } from '../options';
-import { isEmptyDoc, isLine, trim } from './doc-helpers';
+import { isEmptyDoc, isLine, trim, trimRight } from './doc-helpers';
 import { flatten, isASTNode, isPreTagContent } from './helpers';
 import {
     checkWhitespaceAtEndOfSvelteBlock,
@@ -673,6 +673,15 @@ function printTopLevelParts(
     ignoreNext = false;
     svelteOptionsDoc = undefined;
 
+    // If this is invoked as an embed of markdown, remove the last hardline.
+    // The markdown parser tries this, too, but fails because it does not
+    // recurse into concats. Doing this will prevent an empty line
+    // at the end of the embedded code block.
+    if (options.parentParser === 'markdown') {
+        const lastDoc = docs[docs.length - 1];
+        trimRight([lastDoc], isLine);
+    }
+
     return groupConcat([join(hardline, docs)]);
 }
 


Test patch:
diff --git a/test/printer/samples/markdown.md b/test/printer/samples/markdown.md
index c7ba83e..8ccd4bb 100644
--- a/test/printer/samples/markdown.md
+++ b/test/printer/samples/markdown.md
@@ -17,5 +17,4 @@ by offloading the formatting of the fenced code block to prettier-plugin-svelte.
         color: green;
     }
 </style>
-
 ```
Repository: vaskoz/dailycodingproblem-go (go)

Issue:
Day 237
Good morning! Here's your coding interview problem for today.

This problem was asked by Amazon.

A tree is symmetric if its data and shape remain unchanged when it is reflected about the root node. The following tree is an example:
```
        4
      / | \
    3   5   3
  /           \
9              9
```
Given a `k-ary` tree, determine whether it is symmetric.

Pull request:
Day237
Resolves #487.

Patch:
diff --git a/README.md b/README.md
index 4c80f8b..09b2c82 100644
--- a/README.md
+++ b/README.md
@@ -245,3 +245,4 @@ problems from
 * [Day 234](https://github.com/vaskoz/dailycodingproblem-go/issues/481)
 * [Day 235](https://github.com/vaskoz/dailycodingproblem-go/issues/483)
 * [Day 236](https://github.com/vaskoz/dailycodingproblem-go/issues/485)
+* [Day 237](https://github.com/vaskoz/dailycodingproblem-go/issues/487)
diff --git a/day237/problem.go b/day237/problem.go
new file mode 100644
index 0000000..7ce84d6
--- /dev/null
+++ b/day237/problem.go
@@ -0,0 +1,31 @@
+// Package day237 has a note.
+// NOTE: I didn't provide an API for a k-ary
+// tree. It's up to the user to build a valid
+// k-ary tree.
+package day237
+
+// KaryTree is a k-ary tree of integers.
+type KaryTree struct {
+	Value    int
+	Children []*KaryTree
+}
+
+// IsTreeSymmetric answers if its data and shape remain
+// unchanged when it is reflected about the root node.
+func IsTreeSymmetric(tree *KaryTree) bool {
+	return equal(tree, tree)
+}
+
+func equal(a, b *KaryTree) bool {
+	if a == nil && b == nil {
+		return true
+	} else if a != nil && b != nil && a.Value == b.Value {
+		for i := range a.Children {
+			if !equal(a.Children[i], b.Children[len(a.Children)-1-i]) {
+				return false
+			}
+		}
+		return true
+	}
+	return false
+}


Test patch:
diff --git a/day237/problem_test.go b/day237/problem_test.go
new file mode 100644
index 0000000..ab3aedd
--- /dev/null
+++ b/day237/problem_test.go
@@ -0,0 +1,61 @@
+package day237
+
+import "testing"
+
+var testcases = []struct {
+	root      *KaryTree
+	symmetric bool
+}{
+	{&KaryTree{
+		4,
+		[]*KaryTree{
+			{
+				3,
+				[]*KaryTree{{9, nil}, nil, nil},
+			},
+			{
+				5,
+				[]*KaryTree{nil, nil, nil},
+			},
+			{
+				3,
+				[]*KaryTree{nil, nil, {9, nil}},
+			},
+		},
+	}, true},
+	{nil, true},
+	{&KaryTree{
+		4,
+		[]*KaryTree{
+			{
+				3,
+				[]*KaryTree{nil, {9, nil}, nil},
+			},
+			{
+				5,
+				[]*KaryTree{nil, nil, nil},
+			},
+			{
+				3,
+				[]*KaryTree{nil, nil, {9, nil}},
+			},
+		},
+	}, false},
+}
+
+func TestIsTreeSymmetric(t *testing.T) {
+	t.Parallel()
+	for _, tc := range testcases {
+		if result := IsTreeSymmetric(tc.root); result != tc.symmetric {
+			t.Errorf("Expected %v, got %v", tc.symmetric, result)
+		}
+	}
+}
+
+func BenchmarkIsTreeSymmetric(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			IsTreeSymmetric(tc.root)
+		}
+	}
+}
Repository: nvim-lualine/lualine.nvim (lua)

Issue:
(ready to do PR) Feat: add option to draw component even if it's empty, just for the separator
It would be nice if there would be option for unconditionally drawing component even if it's empty just for the separator.

### Motivation

I want be able to include decorative blocks in the statusline like this:
![screenshot_2023_02_11_16_58_29](https://user-images.githubusercontent.com/47556468/218265726-68b384b6-1810-4d03-ad4c-2cbc21a7b5a5.png)
(the one after git branch segment)

I was able to do it however it's not what I exactly wanted because of extra space I had to add.
Ideally I'd like to be able to make it look like that:
![screenshot_2023_02_11_17_06_41](https://user-images.githubusercontent.com/47556468/218265854-48a78636-608d-4e6f-88a0-0f35f40fb768.png)
As you can see it is thinner now because there's no extra space.

<!-- Explain why you think it should be included in lualine.-->
I think it might be useful to other people and it's one line of code to add.

Pull request:
Closes #963

Patch:
diff --git a/README.md b/README.md
index c96c3013e..21ac8825b 100644
--- a/README.md
+++ b/README.md
@@ -419,6 +419,9 @@ sections = {
 
       cond = nil,           -- Condition function, the component is loaded when the function returns `true`.
 
+      draw_empty = false,   -- Whether to draw component even if it's empty.
+                            -- Might be useful if you want just the separator.
+
       -- Defines a custom color for the component:
       --
       -- 'highlight_group_name' | { fg = '#rrggbb'|cterm_value(0-255)|'color_name(red)', bg= '#rrggbb', gui='style' } | function
diff --git a/lua/lualine/component.lua b/lua/lualine/component.lua
index a4d9d9b1a..8efa1a70f 100644
--- a/lua/lualine/component.lua
+++ b/lua/lualine/component.lua
@@ -274,7 +274,7 @@ function M:draw(default_highlight, is_focused)
   if self.options.fmt then
     status = self.options.fmt(status or '', self)
   end
-  if type(status) == 'string' and #status > 0 then
+  if type(status) == 'string' and (#status > 0 or self.options.draw_empty) then
     self.status = status
     self:apply_icon()
     self:apply_padding()


Test patch:
diff --git a/tests/spec/component_spec.lua b/tests/spec/component_spec.lua
index b5dad639f..d3f2af011 100644
--- a/tests/spec/component_spec.lua
+++ b/tests/spec/component_spec.lua
@@ -211,6 +211,19 @@ describe('Component:', function()
       assert.stub(hl.component_format_highlight).was_called_with(comp2.options.color_highlight)
       hl.component_format_highlight:revert()
     end)
+
+    it('draw_empty', function()
+      local opts = build_component_opts {
+        component_separators = { left = '', right = '' },
+        padding = 0,
+        separator = '>',
+        fmt = function()
+          return ''
+        end,
+        draw_empty = true,
+      }
+      assert_component(nil, opts, '>')
+    end)
   end)
 end)
Repository: KaTeX/KaTeX (js)

Issue:
globalGroup adversely affects \color and tall right delimiters
PR #2091 has an unintended consequence. When the rendering option `globalGroup` is set to `true`, then `\color` escapes its group and affects tall right delimiters.

The KaTeX function`\color` works by creating a macro `\current@color` and assigning a color to it. When `globalGroup` is true, then this macro escapes its group. Tall right delimiters are then given that color in line https://github.com/KaTeX/KaTeX/blob/21c4bc355c04cfa13bb79dd9dd06627f5b04f54d/src/functions/delimsizing.js#L155. I don't know why tall right delimiters get that treatment, but there it is.

The stated reason for PR #2091 was to give global scope to `\newcommand`.  But its effect is more sweeping than that. I think that @edemaine's [comment](https://github.com/KaTeX/KaTeX/pull/2091#issuecomment-527243164) was correct. We need some mechanism that gives global scope to `\newcommand`, not to all macros.



Pull request:
fix: Prevent global group from adversely affecting color.
Fix<!--don't close--> #2637. Close #2640.

This PR is an alternative to PR #2640. Either this one or that one, but not both, should be approved and merged. I would prefer PR#2640, but it seems unlikely that anyone will approve it. We should get this bug fixed before the next release so this PR is the next best thing.

Patch:
diff --git a/src/parseTree.js b/src/parseTree.js
index 26270fba..c1cd3df9 100644
--- a/src/parseTree.js
+++ b/src/parseTree.js
@@ -18,10 +18,16 @@ const parseTree = function(toParse: string, settings: Settings): AnyParseNode[]
         throw new TypeError('KaTeX can only parse string typed expression');
     }
     const parser = new Parser(toParse, settings);
+
     // Blank out any \df@tag to avoid spurious "Duplicate \tag" errors
     delete parser.gullet.macros.current["\\df@tag"];
+
     let tree = parser.parse();
 
+    // Prevent a color definition from persisting between calls to katex.render().
+    delete parser.gullet.macros.current["\\current@color"];
+    delete parser.gullet.macros.current["\\color"];
+
     // If the input used \tag, it will set the \df@tag macro to the tag.
     // In this case, we separately parse the tag and wrap the tree.
     if (parser.gullet.macros.get("\\df@tag")) {


Test patch:
diff --git a/test/katex-spec.js b/test/katex-spec.js
index 715513e7..ac10e482 100644
--- a/test/katex-spec.js
+++ b/test/katex-spec.js
@@ -869,6 +869,7 @@ describe("A color parser", function() {
         const macros = {};
         expect(oldColorExpression).toParseLike(r`\textcolor{#fA6}{x}y`, {
             colorIsTextColor: true,
+            globalGroup: true,
             macros: macros,
         });
         expect(macros).toEqual({});