Code Monkey home page Code Monkey logo

racket-commonmark's Introduction

racket-commonmark's People

Contributors

lexi-lambda avatar

Stargazers

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

Watchers

 avatar  avatar

racket-commonmark's Issues

Interest check: support unique footnote anchors

When published as HTML, sometimes multiple rendered documents will appear on the same page, such as on a blog that displays the full text of multiple posts on its home page. If the sources use identical footnote labels (e.g. [^1], [^2], etc.), then the anchors for the reference links and backlinks will collide when they are displayed on the same page.

Not every project will be affected by this. But for those that are, could we add a new parameter named, e.g., footnote-label-prefix, defaulting to "", and prefix its value to all footnote labels in the document during parsing?

#lang racket/base

(require commonmark racket/file)

(define (my-post-renderer source-file)
  (define source-str (file->string source-file)
  (parameterize ([footnote-label-prefix (my-unique-id-maker source-file)])
    (document->html (string->document source-str))))

If you are not interested, please feel free to close this issue without comment. I understand it’s an edge case, and it’s already possible to avoid this by taking care to use reasonably unique labels when writing the markdown source. Also, I could always traverse the AST after the parse and prefix all the labels before rendering. I just thought I’d ask, since it would be faster and more ergonomic to handle it during at parse time.

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.