Giter Site home page Giter Site logo

Fragments about prez HOT 5 CLOSED

JoyMonteiro avatar JoyMonteiro commented on June 8, 2024
Fragments

from prez.

Comments (5)

Delapouite avatar Delapouite commented on June 8, 2024

Hi Joy.

reveal.js parses markdown in 2 distinct phases :

  • one dedicated to classic markdown grammar with marked
  • a custom one handles special comments in the source, like the ones you need to trigger fragments navigation.

Unfortunately, prez only currently takes care of the marked parsing. We'll have a look on how to parse comments properly.

from prez.

JoyMonteiro avatar JoyMonteiro commented on June 8, 2024

Oh, ok. Thanks, and look forward to it!

from prez.

xnum avatar xnum commented on June 8, 2024

@Delapouite I found this issue and try to deal with it,
I forked a marked repo and change the lexer grammar
xnum/marked@0b859c9
then I use __ surround to set strings with fragment
and add $class:fragment class$ on slides' heading

but I think it's not a good solution, do you have any advice on it?

from prez.

Delapouite avatar Delapouite commented on June 8, 2024

The problem about Reveal.js custom comments adding property to markdown is that this is currently done in the DOM itself : https://github.com/hakimel/reveal.js/blob/master/plugin/markdown/markdown.js#L312-L345

Prez does not compile markdown in the browser but in node, so we do not have access to the DOM. One solution could be to extract all the logic from the script aforementioned and run it in a cheerio environment but it would be really hacky.

My best advice therefore when you want to extend so much the markdown syntax, to use fragments for instance, is to simply fallback on normal HTML since it's legal syntax. This way, no need to learn a half-baked DSL.

from prez.

naholyr avatar naholyr commented on June 8, 2024

In order to be able to extend Markdown's syntax you can now use the parser of your choice. Example, using a CLI markdown converter:

// your-project/my-markdown-parser.js
const spawnSync = require("child_process").spawnSync
module.exports = (input) => spawnSync("maruku", { input }).stdout.toString("utf8")
// your-project/.prezrc
parser = ./my-markdown-parser

from prez.

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.