Вот быстрый и грязный способ извлечь код из V3 или V4 ipynb без использования ipython. Он не проверяет типы ячеек и т. Д.
import sys,json
f = open(sys.argv[1], 'r') #input.ipynb
j = json.load(f)
of = open(sys.argv[2], 'w') #output.py
if j["nbformat"] >=4:
for i,cell in enumerate(j["cells"]):
of.write("#cell "+str(i)+"\n")
for line in cell["source"]:
of.write(line)
of.write('\n\n')
else:
for i,cell in enumerate(j["worksheets"][0]["cells"]):
of.write("#cell "+str(i)+"\n")
for line in cell["input"]:
of.write(line)
of.write('\n\n')
of.close()
Итак, мы наконец нашли, как заставить CSS работать с Emotion. Мы преобразовали наш стилизованный компонент в объект и используем & ::selection
. Я не пробовал с космосом, и это было то!
// Emotion
export const Adventure = styled.div({
maxWidth: '1400px',
/* working now! */
'& ::selection': {
color: colors.greenWater,
},
});