Vuepress: Specify/Change Markdown Syntax preference in config.js

Created on 12 Mar 2019  路  4Comments  路  Source: vuejs/vuepress


Feature request



What problem does this feature solve?

Interoperability with iOS Apps by allowing to specify Markdown related settings such as the TOC. Vuepress currently uses [[TOC]]
to specify the TOC of any markdown files. It would be nice to be able to specify what is the syntax used and change it to `{{TOC}}' (example from iA Writer App) as that would allow easier workflow with iOS Apps where most markdown files are edited.

7653982C-EB8C-4DEB-8A25-DA27BEA222F8

What does the proposed API look like?

module.exports = {
  title: 'Hello VuePress',
  markdownSyntax: [
      toc: '{{TOC}}'
]
}

How should this be implemented in your opinion?

I believe this should be included in the config.jsfile to be able to make vuepress
understand and translate other implementations of Markdown features.

Are you willing to work on this yourself?**

I would like to but I do not know how.

All 4 comments

Well I really wish you had read our documentation: https://v1.vuepress.vuejs.org/config/#markdown-toc

Hello. Thank you for closing my question/idea/request. That is really helpful 馃憥

There are still people out there that are trying to learn and in reality, if you have spent 3 more seconds to help some out instead of posting a link that would he been highly appreciated. I read the documentation but I do not believe it relates to what I was saying. That is why I am proposing it. From the documentation I cannot use {{TOC}} instead of [[TOC]], or if it does I have not idea how.

I do not believe you have helped me in any way by just giving me a link, but I have understood your message not to reach out anymore if I have ideas, issues or requests.

@milotindragos
Check if the markerPattern helps

I don't think I misunderstood what you mean. You want to customize TOC syntax and there is relavent API that supports doing so. The syntax you purposed is very inconsistent with the current one, so anyone will think that you have not read the documentation seriously. I mean no offense to you and thank you for trying VuePress.

Closing an issue simply means that the problem is marked as resolved. If it doesn't, we will of course reopen it. If you have to think that closing an issue means closing you, I can only say sorry.

Now, let's go back to the problem you mentioned.

module.exports = {
  markdown: {
    toc: {
      // consistant with markdown-it-table-of-contents
      markerPattern: /^\[\[\[toc\]\]\]/im // custom marker
    }
  }
}
[[[toc]]] <!-- this works -->

However, mustache syntax means interpolation in Vue, which may leads to serious ambiguity if you set {{toc}} to be your syntax. We do not recommend this behavior if you want to write a document with high readability.

Finally, we also plan to further improve the functionality of the TOC before the beta phase. If you have better ideas, feature requests are always welcome.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AMontagu picture AMontagu  路  3Comments

AleksejDix picture AleksejDix  路  3Comments

sankincn picture sankincn  路  3Comments

harryhorton picture harryhorton  路  3Comments

lesliecdubs picture lesliecdubs  路  3Comments