GithubHelp home page GithubHelp logo

yours-truly-phil / codey Goto Github PK

View Code? Open in Web Editor NEW
7.0 3.0 1.0 16.57 MB

Discord bot to compile and run code, all without leaving discord and just a single click away.

License: GNU General Public License v3.0

Java 99.69% Dockerfile 0.31%
bot discord indentation compile wandbox java discord-bot

codey's People

Contributors

davidhancu avatar yours-truly-phil avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

idogsayswhat

codey's Issues

Parse (whitelist) language attribute in codeblocks

Just saw some code blocks that looked like valid java code but I didn't see the โœจ reaction added to it from the CodeFormatter.
Turns out, I didn't know that it's valid to start the content of a code block in the line of the ```. I always expected either the three ``` and a newline or the three ```, then some text (like 'java', 'cpp', etc.) which is the language attribute and then a newline.
I need to be able to recognize whether or not the first word in a codeblock is the language attribute, so I'm looking for a list with shorthands for all supported languages.
So I'm thinking I will either use a comprehensive list like https://github.com/github/linguist/blob/master/lib/linguist/languages.yml to parse the language attribute, or create my own list with all the languages the bot actually supports, which as of now would be just ["java"].

use library to parse markdown inside discord messages

I'm both looking into https://github.com/vsch/flexmark-java and https://github.com/atlassian/commonmark-java

So far, both don't do what I expect:

It's odd that neither of them recognizes the end of the codeblock if trying to parse:

"""
Hello, what's going on,
now comes a code block:
```java
I'm inside the code block
hooray!```
I come after the code block"""

The result after parsing for both libraries is one Paragraph that contains two children:
First child: "Hello, what's going on,"
Second child: "now comes a code block:"

The a second node of type FencedCodeBlock with one child spread over three lines:
Line 1 of FencedCodeBlock: "I'm inside the code block\n"
Line 2 of FencedCodeBlock: "hooray!```\n"
Line 3 of FencedCodeBlock: "I come after the code block"

I expected to have a Paragraph, then a code block and then another paragraph after the codeblock and no ' ```' as part of the content.

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.