Java-Markdown-Generator icon indicating copy to clipboard operation
Java-Markdown-Generator copied to clipboard

Add HyperlinkedImage + OrderedList components

Open Revxrsal opened this issue 5 years ago • 4 comments

Added 2 more components to the library which appear to be missing (???)

HyperlinkedImage


    @Test
    public void withTooltip() {
        String text = new BoldText("Example alt text").toString();
        String imageURL = "https://i.imgur.com/rP1uBWg.png";
        String redirectTo = "https://github.com/Steppschuh/Java-Markdown-Generator";
        String tooltip = "Java Markdown Generator is very useful!";
        HyperlinkedImage image = new HyperlinkedImage(text, imageURL, redirectTo, tooltip);
        System.out.println(image.toString());
    }

Would result in the following:

[![**Example alt text**](https://i.imgur.com/rP1uBWg.png "Java Markdown Generator is very useful!")](https://github.com/Steppschuh/Java-Markdown-Generator)

Which renders as (hover over):

Example alt text

Without tooltip:

    @Test
    public void withoutTooltip() {
        String text = new BoldText("Example alt text").toString();
        String imageURL = "https://i.imgur.com/rP1uBWg.png";
        String redirectTo = "https://github.com/Steppschuh/Java-Markdown-Generator";
        HyperlinkedImage image = new HyperlinkedImage(text, imageURL, redirectTo, null);
        System.out.println(image.toString());
    }

Would result in the following:

[![**Example alt text**](https://i.imgur.com/rP1uBWg.png)](https://github.com/Steppschuh/Java-Markdown-Generator)

Which renders as (hover over): Example alt text

*Can have hyperlink as null too, with or without a tooltip*

OrderedList

    @Test
    public void renderOrderedList() {
        OrderedList list = new OrderedList();
        list.add(new OrderedListItem("An element")).add(new OrderedListItem("Another element through chaining"));
        System.out.println(list);
    }

Would create:

1. An element
2. Another element through chaining

Which results in:

  1. An element
  2. Another element through chaining

With builder:

    @Test
    public void orderedListWithBuilder() {
        OrderedList list = new OrderedListBuilder()
                .append("A")
                .append("B")
                .build();
        System.out.println(list);
    }

Would create:

1. A
2. B

Which results into:

  1. A
  2. B

Let me know if anything should be changed.

Revxrsal avatar Jul 13 '20 21:07 Revxrsal

Hey, thanks a lot for your contribution!

Steppschuh avatar Jul 14 '20 07:07 Steppschuh

@Steppschuh I need this change. Can I ask for a review?

Javakky avatar Sep 05 '22 02:09 Javakky

@Steppschuh I need this change. Can I ask for a review?

This PR is old and probably wouldn't merge correctly. I suggest you create your own fork, introduce the changes as appropriate, and create another pull request.

Revxrsal avatar Sep 06 '22 10:09 Revxrsal

@Revxrsal Thanks! I'll try.

Javakky-pxv avatar Sep 06 '22 10:09 Javakky-pxv