code block insert anki error
NOTE: Do you have the last version of the plugin? If not that's probably the problem
Describe the bug When the tag #card is used to generate the anki card, it is not generated at the end of the code block. If there is a space in the code block, it will end directly.
To Reproduce
- Steps to reproduce the behavior:
- Go to '...'
- Click on '....'
- Scroll down to '....'
- See error
Expected behavior A clear and concise description of what you expected to happen.
Screenshots
Markdown used
读操作 get #card
读的时候和写入是不一样的,这个过程中是不需要加锁,如果读的时候有多个线程正在向CopyOnWriteArrayList添加数据,读还是会读到旧的数据,因为写的时候不会锁住旧的CopyOnWriteArrayList。 这个也是一个缺点
private E get(Object[] a, int index) {
return (E) a[index];
}
public E get(int index) {
return get(getArray(), index);
}
^1620628201203
更新操作 set #card
set的时候也会加锁(和 写操作 是同一把锁)并重新拷贝出一份Array,不用原来的Array数组,所以add和set不能同时进行,也就不会出现冲突
public E set(int index, E element) {
final ReentrantLock lock = this.lock;
lock.lock();
try {
Object[] elements = getArray();
E oldValue = get(elements, index);
^1619491586919
if (oldValue != element) {
int len = elements.length;
Object[] newElements = Arrays.copyOf(elements, len);
newElements[index] = element;
setArray(newElements);
} else {
// Not quite a no-op; ensures volatile write semantics
setArray(elements);
}
return oldValue;
} finally {
lock.unlock();
}
}
Additional context Add any other context about the problem here.
Thank you for taking the time to report the issue and help me to make the project better! 🙂
A way to overcome temporarily the problem is to use a space to have an empty line that will be part of the card.
暂时解决这个问题的一种方法是使用一个空格来放置一个空行,该行将成为卡片的一部分。
thanks. This is useful
But blank lines in the code are very common. If there are too many blank lines, this operation is also an abnormal nightmare