1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 09:46:22 +00:00

Merge pull request #1691 from rayou/fix-smart-quotes-post-to-blog

Fixed smart quotes when posting a note to blog
This commit is contained in:
Junyoung Choi (Sai)
2018-03-17 01:04:50 +09:00
committed by GitHub
2 changed files with 4 additions and 3 deletions

View File

@@ -8,7 +8,6 @@ import {lastFindInArray} from './utils'
// FIXME We should not depend on global variable.
const katex = window.katex
const config = ConfigManager.get()
function createGutter (str, firstLineNumber) {
if (Number.isNaN(firstLineNumber)) firstLineNumber = 1
@@ -22,8 +21,9 @@ function createGutter (str, firstLineNumber) {
class Markdown {
constructor (options = {}) {
const config = ConfigManager.get()
const defaultOptions = {
typographer: true,
typographer: config.preview.smartQuotes,
linkify: true,
html: true,
xhtmlOut: true,

View File

@@ -1,3 +1,4 @@
/* global electron */
import PropTypes from 'prop-types'
import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
@@ -20,7 +21,6 @@ import Markdown from '../../lib/markdown'
const { remote } = require('electron')
const { Menu, MenuItem, dialog } = remote
const WP_POST_PATH = '/wp/v2/posts'
const markdown = new Markdown()
function sortByCreatedAt (a, b) {
return new Date(b.createdAt) - new Date(a.createdAt)
@@ -709,6 +709,7 @@ class NoteList extends React.Component {
authToken = `Bearer ${token}`
}
const contentToRender = firstNote.content.replace(`# ${firstNote.title}`, '')
const markdown = new Markdown()
const data = {
title: firstNote.title,
content: markdown.render(contentToRender),