skygragon / leetcode-cli

A cli tool to enjoy leetcode!
MIT License
3.64k stars 457 forks source link

!!! Bug: code format is not correct. Useless html tag is shown !!! #183

Closed kgfly closed 4 years ago

kgfly commented 4 years ago

Problem Summary

The downloaded code format is not correct. Useless html tag is shown

How to reproduce

I just reinstalled latest 2.6.2 because submit does not work in the old version.

cd rm -fr .npm .nvm

$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash $ source ~/.bashrc $ nvm install --lts $ npm install -g leetcode-cli $ leetcode version

lee show 1 -gx -l python3

Observed: In 1.two-sum.py

#
# @lc app=leetcode id=1 lang=python3
#
# [1] Two Sum
#
# https://leetcode.com/problems/two-sum/description/
#
# algorithms
# Easy (44.54%)
# Total Accepted:    2.1M
# Total Submissions: 4.8M
# Testcase Example:  '[2,7,11,15]\n9'
#
# <p>Given an array of integers, return <strong>indices</strong> of the two
# numbers such that they add up to a specific target.</p>
# 
# <p>You may assume that each input would have
# <strong><em>exactly</em></strong> one solution, and you may not use the
# <em>same</em> element twice.</p>
# 
# <p><strong>Example:</strong></p>
# 
# <pre>
# Given nums = [2, 7, 11, 15], target = 9,
# 
# Because nums[<strong>0</strong>] + nums[<strong>1</strong>] = 2 + 7 = 9,
# return [<strong>0</strong>, <strong>1</strong>].
# </pre>
# 
#
class Solution:
    def twoSum(self, nums: List[int], target: int) -> List[int]:

Expected: I've an old copy downloaded by old version:


#
# @lc app=leetcode id=1 lang=python3
#
# [1] Two Sum
#
# https://leetcode.com/problems/two-sum/description/
#
# algorithms
# Easy (42.32%)
# Total Accepted:    1.6M
# Total Submissions: 3.7M
# Testcase Example:  '[2,7,11,15]\n9'
#
# Given an array of integers, return indices of the two numbers such that they
# add up to a specific target.
# 
# You may assume that each input would have exactly one solution, and you may
# not use the same element twice.
# 
# Example:
# 
# 
# Given nums = [2, 7, 11, 15], target = 9,
# 
# Because nums[0] + nums[1] = 2 + 7 = 9,
# return [0, 1].
# 
# 
# 
# 
#

In the newer version, lots of useless html, such as \<p> \<strong> ... is showing. Very annoying.

Environment

Thanks.

kgfly commented 4 years ago

"rm -fr ~/.lc" solve the issue.

I think the issue is caused by "--no-color" setting per the suggestion from this thread https://github.com/skygragon/leetcode-cli/issues/179

Close it for now.

Thanks.