Giter VIP home page Giter VIP logo

vscode-marky-markdown's Introduction

animated image showing a typewriter typing out the following message: leave your mark on the world and dont be afraid to color outside of the lines. The word outside goes outside of the piece of paper

Latest articles 🗞️

You can subscribe to my RSS Feed.

Support my work

Did I make something that helped you?

You can consider supporting my work. You can buy me a coffee, or make a regular donation. 🌈🪙

Thanks! 🙏

vscode-marky-markdown's People

Contributors

robole avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vscode-marky-markdown's Issues

[Feature Suggestion] HTML option for Marky Dynamic

Hello👋 Really loves your extension, absolutely helpful!

However, i'm curious, is this repo still maintained, and if yes, can you add an option to turn the generated 'table of content' into a html one? So it can become a dropwdown list like this:

Table of Contents
  1. Installation
  2. About
  3. Example
  4. Syntax

i use this code to manually turn the generated TOC from your extension into the html one. (it's not perfect, it also has flaws, since I'm a noob, but i hope you got my point)

intro = """
<details>
  <summary>Table of Contents</summary>
  <ol>
"""

outro = """
    </li>
  </ol>
</details>
"""

tableofcontents = """
- [Installation](#installation)
- [About](#about)
- [Example](#example)
- [Syntax](#syntax)
  - [Valid Hashtags](#valid-hashtags)
"""

def mlineprint(toprint):
    if toprint[-1] == '\n':
        toprint = toprint[:-1]
    print(toprint.replace('\n', '', 1))


def writehtmllist(space, namehead, hashtaghead):
    spaces = ""
    for _ in range(space):
        spaces += " "
    if initialspace >= 2:
        return spaces + f'<ul><li><a href="{hashtaghead}">{namehead}</a></li></ul>'
    else:
        return spaces + f'<li><a href="{hashtaghead}">{namehead}</a></li>'

if __name__ == "__main__":
    rows = tableofcontents.replace('\n', '', 1).splitlines()#split('\n')  # split into a list of rows
    mlineprint(intro)
    for row in rows:
        if not row == '':
            initialspace = 0
            for char in row:
                if char == ' ':
                    initialspace += 1
                else:
                    break
            extractedrow = row.split("[")
            cuttedrow = extractedrow[1].partition("](")
            headingname = cuttedrow[0]
            headinghashtag = cuttedrow[2].rstrip(")")
            print(writehtmllist(initialspace+4, headingname, headinghashtag))
    mlineprint(outro)

That's from me. I don't know if it's possible (i mean easy to implement) or not, and if you don't want to implement it, that's totally okay!

I hope you an amazing day✨

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.