mjbvz / vscode-markdown-mermaid

Adds Mermaid diagram and flowchart support to VS Code's builtin markdown preview
https://marketplace.visualstudio.com/items?itemName=bierner.markdown-mermaid
MIT License
630 stars 112 forks source link

Allow the user to override all Mermaid string-specific word wrap preferences using the VSCode-native word wrap preference. #243

Open RokeJulianLockhart opened 5 months ago

RokeJulianLockhart commented 5 months ago

20240204T124756GMT

Just do what every other renderer does — adhere to the text wrap preference: if wrap is enabled, wrap it. If not, display scrollbars. Regardless, never automatically, much less without the ability to not, reduce the size of the text! I have a smartphone and tablet with VS Code on it too - how am I meant to even use this on them? Consider the accessibility disadvantage of not doing so, which is that a great many people won't even be able to read that.

I hope we don't have to wait on https://github.com/mermaid-js/mermaid/issues/1860#issue-789654857, because I'm proposing that the system-defined/VSCode-exposed font size is always used.

mjbvz commented 5 months ago

Please share an example diagram as copiable text

RokeJulianLockhart commented 5 months ago

https://github.com/mjbvz/vscode-markdown-mermaid/issues/243#issuecomment-1928606836

@mjbvz,

```mermaid
flowchart TD

n1["`Law`"] --> |<i>Hierarchy| s3

s1 --> |Votes| n1
s2 --> |Votes| n1
s5 --> |Votes| n1
s8 --> |Votes| n1

subgraph s10["`**Nation 1**
    An external placeholder nation which exists to demonstrate that legally, alternate nations are able to exist outside the bounds of Nation 0. However, whether any alternative nation(s) should exist should be considered carefully.

    A sensible reason for such a nation to exist is physics constraints so severe that due to lack of ability to contact and/or provide physical assistance to the nation, it must govern itself. Expected inability to *ever* contact the other nation is a situation in which this applies, perhaps if it is travelling into space at a relevant pace and to a relevant eventual distance.`"]
end

s10 -.- |<i>Hierarchy| s3

subgraph s3["`**Nation 0**
    This is the nation which this document describes. It should be the most powerful nation economically and militarily in order to prevent invasion, in order to sustain its meritocratic and just institutions.`"]

    subgraph s1["`**Administration Authority**
        Provides administration to its ultimately separate subordinates.`"]

        n3["`**Rank 0 Administration Officer**
            This role is the highest authority - the head of state.`"]

        n3 --> |<i>Hierarchy| s9

        subgraph s9["`**Administration Innovation Authority**
            Innovates methods of improvement of administration of its subsidiaries.`"]

        end
    end

    s1 --> |<i>Hierarchy| s4

    subgraph s4["`**Product and Service Improvement Authority**
        Provides competition against, and mutually advantageous co-operation with, private organizations.`"]

        subgraph s6["`**Public Service Authority**
            To ensure healthy competition, a singular public entity would be established to compete with private companies. Subordinate entities would be created in a federal manner to compete in specific sectors such as food, clothing, and basic digital devices. The more specific the need, the more entities would be the entity's parent, unless its purview does not fit into the systems of the existent entities, in which case it could without problem be subservient solely to the ultimate parent despite being niche.

            This system aims to enhance affordability, quality, and customer service by fostering market competition, because whereas the private system when comprised of small companies is incapable of *not* innovating in the short term in order to survive, the government would take the role of traditional private monopolies, yet would instead use that power to slowly enhance the quality of its development systems and products by utilizing the innovations of the private sectors. It *would* improve due to its federal structure - accountability goes up the chain to the head of state, and consolidates those with similar interests into groups able to demonstrate their competence yet managed by those with broader visions. It's the standard system of competing interests, but properly managed.`"]

            subgraph s2["`**Waste Management**
                Provides waste management services.`"]

                n6["Rank 1 Waste Collector"]
                n7["Rank 1 Waste Disposer"]

            end

            subgraph s5["`**Fire Management**
                Provides waste management services.`"]

                n8["`Rank 1 Firefighter`"]
                n9["`Rank 1 `"]

            end

            subgraph s8["`**Law Enforcement**
                Enforces law.`"]

                n10["`Rank 1 Patroller`"]
                n11["Rank 1 "]

            end
        end
    end
end
```

image

RokeJulianLockhart commented 4 months ago

https://github.com/mjbvz/vscode-markdown-mermaid/issues/243#issuecomment-1928613837

@RokeJulianLockhart, https://www.mermaidchart.com/blog/posts/automatic-text-wrapping-in-flowcharts-is-here#automatic-text-wrapping works!

RokeJulianLockhart commented 4 months ago

https://github.com/mjbvz/vscode-markdown-mermaid/issues/243#event-11914188599

@RokeJulianLockhart, that method forces wrapping, so it still doesn't allow this extension to adhere to the word wrap preference, although it's a stopgap:

image