GithubHelp home page GithubHelp logo

Comments (3)

jeanphilippegg avatar jeanphilippegg commented on September 14, 2024 1

Hyphens and underscores (as a single character) are already permitted in titles. The default sluggification of titles replaces spaces and underscores with hyphens. That is probably what you find undesirable. I recommend you try to disable sluggification for all file components, like this:

(setq denote-file-name-slug-functions
    '((title . identity)
      (signature . identity)
      (keyword . identity)))

This way, you can have underscores and hyphens (and uppercase and spaces, etc.) in your titles. If you would like to keep some of the current default sluggification (eg downcasing), you can create your own function. Check denote-sluggify-title as an example.

As for single underscores in the keywords, this is not currently possible because it is the keywords separator.

In summary, only consecutive -,_ and = are reserved in Denote's file names. They can be used as single characters freely (if the default sluggification is disabled), with the exception that single underscores cannot be used in keywords because of the above.

from denote.

protesilaos avatar protesilaos commented on September 14, 2024 1

from denote.

torusJKL avatar torusJKL commented on September 14, 2024

This is the changed function I'm using now in my workflow.
(based on the existing ones in denote.el)

(defun denote--slug-hyphenate-gb (str)
    "Replace spaces with hyphens in STR.
Also replace multiple hyphens with a single one and remove any
leading and trailing hyphen."
  (replace-regexp-in-string
    "^-\\|-$" ""
    (replace-regexp-in-string
       "-\\{2,\\}" "-"
       (replace-regexp-in-string "\s+" "-" str))))

(defun denote-sluggify-title-gb (str)
    "Make STR an appropriate slug for title but keep punctuation."
    (downcase (denote--slug-hyphenate-gb (denote--slug-no-punct str))))

from denote.

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.