删除R,Rmarkdown中`bookdown`中的facebook和twitter链接

时间:2016-05-19 20:10:16

标签: r knitr bookdown

我正在使用R中的bookdown包来编写一个gitbook,但我不希望最后一本书有到facebook,twitter的共享链接。我在YAML

中使用了类似的内容
--- 
title: "A Minimal Book Example"
author: "SN"
date: "`r Sys.Date()`"
output: 
  bookdown::gitbook
    gitbook_config:
      sharing:
        facebook: false
        twitter: false
documentclass: book
link-citations: yes
description: "This book ... ."
---

但是我收到了错误

Error in yaml::yaml.load(enc2utf8(string), ...) : 
  Scanner error: mapping values are not allowed in this context at line 6, column 19
Calls: <Anonymous> ... yaml_load_utf8 -> mark_utf8 -> <Anonymous> -> .Call
Execution halted

任何人都可以帮助我设置YAML中的选项,以便在最终渲染中不显示共享选项吗?

谢谢! SN

1 个答案:

答案 0 :(得分:1)

两个错误:

  1. 您在function isUserExists(query, callback) { User.findOne(query, function(error, user) { if(error) { return callback(error); } callback(null, !!user); }); } function sendResponse(res, error, result) { if(error) { res.statusCode = 500; log.error('Internal error(%d): %s', res.statusCode, err.message); return res.json({error: 'Server error'}); } if(!user) { res.statusCode = 404; return res.json({ error: 'Not found' }); } res.json(result); } router.get('/:id', function(req, res) { isUserExists({emailAddress: req.params.id}, sendResponse.bind(null, res)); }); router.get('/username/:id', function(req, res) { isUserExists({username: req.params.id}, sendResponse.bind(null, res)); }); ;
  2. 之后省略了冒号
  3. bookdown::gitbook应为gitbook_config
  4. config