readthedocs / readthedocs.org

The source code that powers readthedocs.org
https://readthedocs.org/
MIT License
7.99k stars 3.58k forks source link

Markdown formatting rendering is incorrect on readthedocs compared to github/local editor. #6860

Closed LexiconCode closed 3 years ago

LexiconCode commented 4 years ago

Details

Tested mkdocs v1.0.4 Python 2.7 mkdocs v1.1 Python 3.8

Expected Result

Markdown should render and display as it does in the local editor or on GitHub

Actual Result

Bullet points and Numbered lists don't always display correctly.

The following text is how the markdown should render.

Creating Hooks and Events

Hooks are a new concept to Caster 1.x.x. The basic idea is that Caster itself defines "events." Event objects contain immutable information about the stuff going on in the "guts" of Caster. Those objects are fed to "hooks", user-defined listeners, which can do whatever they want with that event data.

Hooks and Events make use of dependency injection and class inheritance through base classes. This design pattern coupled with loosely coupled code leads to less bugs and more productivity, and so the use of hooks rather than "guts" modifications is encouraged whenever possible. This should allow a decent amount of customization to happen without needing to make changes in the "guts" (Nexus, GrammarManager, CCRMerger, etc. of Caster.

All new hooks are set to false by default unless they're defined as defaults in settings.toml under default_hooks.

  1. Hook Runner Placement

    First to figure out what data you want to monitor In the source code and create a hook runner. For example printer hook monitors Enabled/Disabled rules states. See grammar_manager.py. A hook runner runs every time an event occurs. Printer Hook runner example self._hooks_runner.execute(RuleActivationEvent(class_name, enabled)) .

    The Anatomy of hook runner:

    • self._hooks_runner.execute: executes the event as a hook runner

    • RuleActivationEvent: class name is the reference to the Event.

    • (class_name, enabled): event data are variables from source code captured by the Event.

    Note: Hook Runners can be reused to capture data throughout the source code in multiple functions assuming the observed data uses the same variables.

  2. Create a Event

    Create a Event and add to Event types.

    • Events/Event types can be reused in hooks.

    • Don't forget to import the event at the location of your hook runner.

The event needs class name RuleActivationEvent, event type EventType.ACTIVATION , and the variables (class_name, enabled).

from castervoice.lib.merge.ccrmerging2.hooks.events.base_event import BaseHookEvent
from castervoice.lib.merge.ccrmerging2.hooks.events.event_types import EventType

class RuleActivationEvent(BaseHookEvent):
    def __init__(self, rule_class_name, active):
        super(RuleActivationEvent, self).__init__(EventType.ACTIVATION)
        # Data from the hook runner
        self.rule_class_name = rule_class_name 
        self.active = active 
  1. Create a Hook.

Hooks need class name PrinterHook, Event type EventType.ACTIVATION and a pronunciation"printer"

Hook can be enabled/disabled while Caster is running. The get_pronunciation Is returned as printer


How it actually displays on readthedocs.io image

stsewd commented 4 years ago

@LexiconCode I saw you added a configuration file to your project now, if you are still having this problem, please pin the mkdocs version to the one that's working locally https://github.com/dictation-toolbox/Caster/blob/c1e7a527f5a77b9337bd216d4cef3f227ff42b2d/docs/build/requirements.txt#L5

We install 0.17.3 as default

LexiconCode commented 4 years ago

I've tested with minimal edits to mkdocs.yml. e.g. pages: from nav: There's only so much time for me to go back so many versions.

Testing procedure:

  1. pip install mkdocs==x.xx.x
  2. mkdocs serve
  3. Check documentation in question
  4. pip uninstall mkdocs-bootswatch mkdocs-bootstrap mkdocs -y
  5. Rinse and repeat for each mkdocs version

Notes

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

LexiconCode commented 4 years ago

What other information can I provide?

humitos commented 4 years ago

We don't do anything special regarding the parser. @LexiconCode did you try pinning all the versions you have installed locally to be installed on Read the Docs as well? (that includes mkdocs, the theme, etc)

Can you link the URL of the .md file in your repository that you are rendering? Also, the URL of the rendered version under Read the Docs.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

LexiconCode commented 4 years ago

Can you link the URL of the .md file in your repository that you are rendering?

https://github.com/dictation-toolbox/Caster/blob/master/docs/readthedocs/Customize_Caster/Creating_Hooks_and_Events.md

Also, the URL of the rendered version under Read the Docs.

https://caster.readthedocs.io/en/latest/readthedocs/Customize_Caster/Creating_Hooks_and_Events/

LexiconCode commented 4 years ago

@humitos thank you for your thoughts. Could you try copying pasting .md files and see if you can replicate the issue? It should be a fairly quick thing to do via mkdocs serve

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

LexiconCode commented 4 years ago

This is still an issue.

stsewd commented 3 years ago

I'm able to replica this locally in a clean environment

Screenshot_2020-10-06 Creating Hooks and Events - Caster

So isn't a problem with rtd itself but a dependency/mkdocs

LexiconCode commented 3 years ago

That's great news, thank you! There are few other places in the Caster docs where this is an issue. If more reference materials for the issue needed let me know.

stsewd commented 3 years ago

@LexiconCode you should be able to reproduce this locally and report to mkdocs. I tested this in fedora 32, python 3.8 with the version of mkdocs in your requirements file.

pip install -r docs/build/requirements.txt
mkdocs build
stsewd commented 3 years ago

Closing as this doesn't look like a problem with rtd itself