Git Product home page Git Product logo

docket's People

Contributors

iwillspeak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

abdulazizaljbri

docket's Issues

Support Stemming and Stopwords in Search

We should add in support for stemming and stopword removal. We should also consider switching from term frequency to
some variant of TFIDF for search too. This would normalise search term frequency accross documents to hopefully filter out common words. We could also consider some kind of cutoff to prevent words common to all texts from being included in the index.

Originally posted by @iwillspeak in #20 (comment)

  • Stemming and stopword removal
  • TFIDF
  • Drop insignificant terms?

Permalinks on Titles

Currently titles have an #id assigned to them to allow linking from within the page. These links can be copied and used to share a deep link to a certain page section. We could do with a few ergonomic improvements however:

  • Highlight the target item in the TOC if an ID link is active
  • Add # or link icon on hover to the titles to make it more obvious that these can be copied. We could even add js onclick handling to copy them.

Update Pulldown

We're using quite an outdated copy of pulldown now. We should fix that.

Links from Index Dont' Have Trailing `/`

This causes a lot of unwanted HTTP 301 redirects. Things would be a lot nicer if we just emitted a link to the folder directly.

Fingers crossed this should be as simple as adding / to the TOC links here.

Markdown Table Support

It would be super nice to have support for tables. Pulldown should support this, we just need to enable the extension feature and provide css for their styling.

Fixup Features

Features added in #10 are broken.

diff --git a/src/docket.rs b/src/docket.rs
index 3ad1920..1ade956 100644
--- a/src/docket.rs
+++ b/src/docket.rs
@@ -162,18 +162,18 @@ impl Docket {
 }
 
 /// Map a collection, using Rayon.
-#[cfg(par_render)]
+#[cfg(feature="par_render")]
 fn map_maybe_par<T, F, U>(input: Vec<T>, f: F) -> Result<Vec<U>, Error>
 where
     T: Sync,
-    F: Fn(T) -> Result<U, Error> + Send + Sync,
+    F: Fn(&T) -> Result<U, Error> + Send + Sync,
     U: Send,
 {
     use rayon::prelude::*;
-    input.par_iter().map(f).collect()
+    input.into_par_iter().map(f).collect()
 }
 
-#[cfg(not(par_render))]
+#[cfg(not(feature="par_render"))]
 fn map_maybe_par<T, F, U>(input: Vec<T>, f: F) -> Result<Vec<U>, Error>
 where
     F: Fn(T) -> Result<U, Error>,
diff --git a/src/main.rs b/src/main.rs
index b0a5b7d..de5a033 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -45,11 +45,11 @@ struct Args {
     flag_target: Option<String>,
 }
 
-/// On Erorr Behaviour
+/// On Error Behaviour
 ///
 /// Chooses what should happen if an error happens when running the build.
 #[derive(PartialEq, Copy, Clone)]
-#[cfg_attr(not(watch), allow(dead_code))]
+#[cfg_attr(not(feature="watch"), allow(dead_code))]
 enum OnError {
     Skip,
     Exit,
@@ -77,7 +77,7 @@ fn main() {
     let target = path_or_default(args.flag_target, "build/");
 
     if args.flag_watch {
-        #[cfg(watch)]
+        #[cfg(feature="watch")]
         {
             use notify::{watcher, RecursiveMode, Watcher};
             use std::sync::mpsc::channel;
@@ -99,7 +99,7 @@ fn main() {
                 }
             }
         }
-        #[cfg(not(watch))]
+        #[cfg(not(feature="watch"))]
         eprintln!("Watch not supported.");
     } else {
         run(&source, &target, OnError::Exit);

Add Watch Flag

It's often nice to have the documentation that's being generated kept in line with the
input markdown. Update the main docket executable to add a --watch flag which
will re-generate documentation when a file changes.

Feature Flags for Watch and Rayon

Currently docket comes 'all or nothing'. The watch support and rayon parallelisation come at quite a cost though.

Add a set of feature flags, enabled by default, which allow users to choose if they want those features:

  • watch - inotify and friends have a lot of dependencies
  • parallel - Some people may be willing to dispense with Rayon

For the watch feature the body of the watch branch in main.rs needs extracting to a function and wrapping with a cfg(watch). When watching isn't enabled we will need a stub implementation which prints an error and exits.

For Rayon removal we will need two copies of the renderd_pages in docket.rs. One which uses Rayon and one which doesn't.

No syntax highlighting?

I can't get the syntax highlighting to work:

image

I did open the docs from an HTTP server, not from disk:

image

image

Update Failure

Failure has security issues causing dependabot alerts. Switch the error system away from it to another crate. Just a manual implementaiton of Error and a dyn Error return might be enough.

Add Javascript Search

Generate some kind of 'index.json' and have some javascript to search it maybe? Could stick the search box in the footer somewhere on most pages, and somewhere in the header on the index?

Even better if it is web assembly and compiled from Rust.

Copy Assets to the Output Directory

Currently only the markdown files are coped. Maybe every file should be copied, and just markdown transformed. This would be useful for including images in the final output without having to copy them across later.

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.