Code Monkey home page Code Monkey logo

docmaker's Introduction

docmaker

CRAN status R-CMD-check

Overview

docmaker is a package that allows you to automate your workflow for taking notes or creating documentation and publish it as a webpage using GitHub pages, MkDocs, and Rmarkdown or Quarto or Markdown.

If you have a repository with files built with Rmarkdown/Quarto/Markdown that you would like to take to MkDocs; docmaker will help you with the all the steps in the middle to achieve this.

Installation

You can install the development version of docmaker from GitHub with:

devtools::install_github("ronnyhdez/docmaker")

If you don´t have the devtools package installed, run the following:

install.packages("devtools")

Usage

You can create your repository on GitHub, clone your repo and from there, you will need to implement a structure to be able to use GitHub pages and MkDocs. For this you can use the function:

library(docmaker)
build_repo(github_page_url = "https://ronnyhdez.github.io/drawer/",
           site_author = "Ronny A. Hernández Mora")

Once you have a repository, you can take your Rmarkdown/Quarto/Markdown notes and deploy them with GitHub pages

make_doc(file = "check.Rmd", mkdocs_build = TRUE, mkdocs_deploy = TRUE)

If you have several files in the root of your project directory, you can instead use the following function to build and deploy all your Rmd files:

make_all_docs(deploy = TRUE)

In the case of having md files, you can use the following function to update them in the folder that is deployed to GitHub pages:

update_md_files("~/Desktop/test_docmaker")

If a file is no longer needed, and you erase that file from your root directory, it will needed to update the docs/ folder. In that case we can use the function:

clean_files()

Getting help

If you find a bug please fill an issue with a reproducible example on GitHub

Ref

Image is the bibliotekarien

docmaker's People

Contributors

ronnyhdez avatar

Stargazers

María Montero-Sánchez avatar J. Antonio Guzmán Q. avatar Frans van Dunné avatar

Watchers

James Cloos avatar  avatar

Forkers

fvd

docmaker's Issues

Update function to process `qmd` documents

So far, the function takes just the Rmd documents. Given that we have nowadays the qmd file format, I can update the function to include in the processing these files.

Function to update list of files in the index

I don't want to change everytime that I have a new note the link in the index. Could work for the initial stage of the blog, and not so good idea if there are a lot of notes given that we already have the index on the side.

Implement functionality created for md docs into rmd or qmd docs

Inside the function, there is code to check if the files in the docs folder have a recent day compared to the files in the root. This could be useful in the functions that render the rmd or qmd documents, so every time I want to update files, I will render just the documents with changes and not the complete files in the root path.

The idea is to compare dates. I'm not completely sure if this is a good idea given that the rmd/qmd file could have a date time and the render files can have another datetime value that differs by just a little.

Find way to implement this under the github workflow

Until now, this process is being designed to work as a local, personal repository, but things change if I want to integrate this in a organization, probably the best fit is the github workflow. This have some impacts in the design

Include the erasing of folders that belongs to erased files

The function clean_files() is working fine but it just erases the md files in the docs/ folder that are no longer in the root file.

Nonetheless, if one of this files included images, those images in their respective folder were saved in the docs/ folder. For our look they follow the pattern with the names of the file they were created from.

I need to update the clean function to erase also those folders.

Create function to delete notes

Probably, at some point one would like to erase a post.

I can create a function to delete any post, deploy the site with the new changes.

This can have two options: erase the posts from the page completely or to erase the post from the web site but not from the notes

Include md files to be copied to docs

Sometimes I'm going to write documents directly as .md documents, so I should include in the function, that if there is a md file, there is no need to render this one, but I need to copy this one to docs folder so it can be rendered.

Function to clean old files

I just erase one md file from the root of the directory and update another md with the new function update_md_document.

Nonetheless, given that I just erased one file in the root of the directory, the old md file copy is still in the docs folder. I need a function to delete old md files that are in the docs folder but not anymore in the root of the directory.

Update function so images are copy to the docs folder

Given that I have a document with images, I need to copy the images in the docs folder:

Output created: 03-nicoya.md
INFO     -  Cleaning site directory
INFO     -  Building documentation to directory: /home/ronny/Documents/repos/github/test_docmaker/site
WARNING  -  Documentation file '03-nicoya.md' contains a link to 'images/nicoya_wikipedia.png' which is not found in the documentation files.
WARNING  -  Documentation file '03-nicoya.md' contains a link to 'images/nicoya_sunset.jpg' which is not found in the documentation files.
WARNING  -  Documentation file '03-nicoya.md' contains a link to 'images/nicoya_lanscape.jpg' which is not found in the documentation files.
INFO     -  Documentation built in 0.18 seconds
INFO     -  Cleaning site directory
INFO     -  Building documentation to directory: /home/ronny/Documents/repos/github/test_docmaker/site
WARNING  -  Documentation file '03-nicoya.md' contains a link to 'images/nicoya_wikipedia.png' which is not found in the documentation files.
WARNING  -  Documentation file '03-nicoya.md' contains a link to 'images/nicoya_sunset.jpg' which is not found in the documentation files.
WARNING  -  Documentation file '03-nicoya.md' contains a link to 'images/nicoya_lanscape.jpg' which is not found in the documentation files.

Include functions from drawer

drawer is going to stay just as a notes repository and all the needed functions to make the process faster to publish the notes, will be here.

Check warning with documentation

Warning: [/home/ronny/Documents/repos/github/docmaker/R/build_repo.R:19] @example spans multiple lines. Do you want @examples?
Warning: [/home/ronny/Documents/repos/github/docmaker/R/make_all_docs.R:20] @example spans multiple lines. Do you want @examples?
Warning: [/home/ronny/Documents/repos/github/docmaker/R/make_doc.R:16] @example spans multiple lines. Do you want @examples?
Warning: [/home/ronny/Documents/repos/github/docmaker/R/publish_from_folder.R:13] @example spans multiple lines. Do you want @examples?

Documents created with qmd are not rendering the TOC

Now that I have changed the R notes to one file using a qmd document, the md render file that is being deployed with mkdocs, does not have the TOC.

The markdown files does contain the TOC just using the titles and subtitles md syntax.

This can be checked on the drawer repo.

Issues on windows:

Pasos en windows para docmaker

En command prompt (“Windows Key+R”)
python --version

Instalar pip:

Bajar archivo https://bootstrap.pypa.io/get-pip.py

Luego en el command prompt
py get-pip.py

Para instalar mkdocs en windows

py -m pip install mkdocs

Instalar tema matherial

py -m pip install mkdocs-material

Docmaker

para correr en windows tenemos que hacer:

py -m mkdocs serve

En el paquete lo tengo como:

  • mkdocs build --config-file=mkdocs.yml
  • mkdocs gh-deploy --strict --force

system("py -m mkdocs build --config-file=mkdocs.yml")

Load dplyr dependency

I have the error:

> make_all_docs(deploy = TRUE)
Error in files %>% purrr::map(make_doc) : could not find function "%>%"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.