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

代码块滚动条以及缩进问题 #497

Open
atitwx opened this issue Dec 24, 2024 · 7 comments
Open

代码块滚动条以及缩进问题 #497

atitwx opened this issue Dec 24, 2024 · 7 comments

Comments

@atitwx
Copy link

atitwx commented Dec 24, 2024

image 复制到公众号文章时,没有滚动条,且会自动换行如下 image

代码如下

package main

import (
	"fmt"
	"sort"
)

func main() {
	nums := []int{1, 0, -1, 0, -2, 2}
	fmt.Println(fourSum(nums, 0))

}

// https://leetcode.cn/problems/4sum/description/
func fourSum(nums []int, target int) [][]int {
	if len(nums) < 4 {
		return nil
	}
	res := make([][]int, 0)
	sort.Ints(nums)
	for i := 0; i < len(nums)-3; i++ {
		if i > 0 && nums[i] == nums[i-1] {
			continue
		}
		for j := i + 1; j < len(nums)-2; j++ {
			if j > i+1 && nums[j] == nums[j-1] {
				continue
			}
			left, right := j+1, len(nums)-1
			for left < right {
				sum := nums[i] + nums[j] + nums[left] + nums[right]
				if sum == target {
					res = append(res, []int{nums[i], nums[j], nums[left], nums[right]})
					for left < right && nums[left] == nums[left+1] {
						left++
					}
					for left < right && nums[right] == nums[right-1] {
						right--
					}
					left++
				} else if sum < target {
					left++
				} else {
					right--
				}
			}
		}
	}
	return res
}

这里粘贴的代码缩进只是一个TAB....

其他建议:代码块,代码语法缩进需要调整

@yanglbme
Copy link
Member

滚动条是有的:

image

@atitwx
Copy link
Author

atitwx commented Dec 24, 2024

PixPin_2024-12-24_11-34-16

上述是我的操作,使用的默认样式...为啥这么奇怪...
weixin编辑器灰度??

yanglbme added a commit that referenced this issue Dec 24, 2024
@yanglbme
Copy link
Member

缩进问题看看好了没,我改了下

@atitwx
Copy link
Author

atitwx commented Dec 24, 2024

速度迅速,🐮
image
但是依旧有代码自动换行,无滚动条的问题,这个问题目前只有我这里遇到了吗

@yanglbme
Copy link
Member

我这里复制到公众号,代码都正常,能左右滚动

@yanglbme
Copy link
Member

试试加入:&mpeditor=0,然后重新加载公众号页面

image

@atitwx
Copy link
Author

atitwx commented Dec 25, 2024

&mpeditor=0还真可以,🐮

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

2 participants