Giter Site home page Giter Site logo

Comments (9)

kohske avatar kohske commented on August 24, 2024

I suggest that slide separator should be accompany at least one-line blank before it.

foo
---

This is <h3> originally, and

foo

---

This is <hr/>

from slidify.

ramnathv avatar ramnathv commented on August 24, 2024

Good point. I always use a blank before and after the slide separator, which is why I never encountered an error thus far. But there are several use cases like the one you point out, where it could lead to different outcomes.

Some of the ruby based slide generation gems use !SLIDE as the slide separator. It defines slides a lot clearer. In fact, if you go through the current code base of slidify, that is the separator I use internally, converting --- on the fly to the actual separator.

The advantage of --- is that it is easy to type, clean and is pandoc compatible, which is great, since it allows you to generate beamer slides from your slidify document. The drawback is resolving the ambiguities it creates.

Any thoughts on this?

from slidify.

kohske avatar kohske commented on August 24, 2024

I like --- because, it is simple and also used for <hr> in generation of html.

I thinks the rule is simple: <hr> will be replaced by the slide separator.
http://daringfireball.net/projects/markdown/syntax#hr

from slidify.

ramnathv avatar ramnathv commented on August 24, 2024

Currently, slidify recognizes the following as slide separators.

  1. --- foo bar #my-id
  2. !SLIDE foo bar #my-id
  3. <!SLIDE foo bar #my-id>

I need to think about rationalizing them in order to keep the design simple. The advantage of --- is that

a. easy to use and logical
b. resulting markdown document displays well

If users add slide classes to the same line, they can enclose it within angled brackets so that it doesnt show up in the rendered version of the markdown document.

I will give this a little more thought, but I am more or less convinced that the way to go about it is to allow the following three separator formats

  1. --- foo bar #my-id
  2. < --- foo bar #my-id >
  3. <!-- ---foo bar #my-id >

from slidify.

ramnathv avatar ramnathv commented on August 24, 2024

I think I figured out the required regexes. Here is the code that would do it. I realized that another advantage of using --- is to keep it pandoc compatible so that a user can export the presentation as a beamer pdf.

x1 <- "--- foo bar #my-id"
x2 <- "<--- foo bar #my-id>"
x3 <- "<!-- --- foo bar #my-id>"

spat <- "^(?<sep><?(?<comm>!--)?\\s?---\\s?(?<attribs>.*)>?$)"

slidify:::re.capture(spat, x1)$names

from slidify.

ramnathv avatar ramnathv commented on August 24, 2024

Automatic Insertion of Separators This feature idea is stolen from pandoc which uses the idea of a slide-level to split a markdown file into slides. It has some heuristics to auto detect the slide level. Once detected pandoc uses the following rules:

  1. Headers at the slide level always start a new slide.
  2. Headers below the slide level create headers within a slide.
  3. Headers above the slide level create title slides.

I need to factor this by modifying my code for add_slide_separator

add_slide_separator <- function(doc, slide_header_level){
  n = slide_header_level
  if (any(grep('^---', doc))){
    doc = gsub("^---", "!SLIDE", doc)
  } else {
    doc = gsub("^(#{n,}.*)$ ", "<!SLIDE>\n\\1", doc)
  }
  return(doc)
}

Here are a couple of issues I foresee

  1. I need to write a function to determine the slide_level using the pandoc heuristic.
  2. I need to ignore # inside fenced code blocks.

from slidify.

ramnathv avatar ramnathv commented on August 24, 2024

I am facing another issue with this choice of separator, since <!-- --- --> hides the entire document in markdown preview since hyphens are not allowed inside comments. I need to figure out a way to sort this.

from slidify.

ramnathv avatar ramnathv commented on August 24, 2024

I am revisiting my choice of slide separator. I really like my current choice of using --- followed by key:value pairs and using punctuations to quickly specify commonly used metadata. The only thing that sticks out is that the separator line stands out in the html rendering of the md file.

A common approach taken by google-io2012 and remark.js is to use the following format to specify slides. This is in line with what I was thinking about when I looked at custom yaml metadata by slide. The syntax is clean albeit a little verbose.

I am torn between these two equally appealing approaches. There might be a way to combine the two approaches and let the user use either of the two.

---

id: id
class: [class1, class2, class3]
name: slide

These are slide contents

from slidify.

ramnathv avatar ramnathv commented on August 24, 2024

It is now possible to do this.

--- {#id, class: [class1, class2, class3], name: slide}

from slidify.

Related Issues (20)

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.